Skip to content

Rvalue::Repeat should hold a ty::Const #68567

Closed
@varkor

Description

@varkor
fn test<const N: usize>() {
    let array = [0; N];
}

currently fails with error: array lengths can't depend on generic parameters, because we can't tell what concrete value N should take here. This is an artificial limitation: when producing a Rvalue::Repeat, we currently need to provide the length of the array, which is impossible at this stage.
cc #43408 (comment)

Metadata

Metadata

Assignees

Labels

A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlA-const-genericsArea: const generics (parameters and arguments)C-enhancementCategory: An issue proposing an enhancement or a PR with one.F-const_generics`#![feature(const_generics)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions