ICE when using generic array type depending on expression of const generics #68130
Labels
A-const-generics
Area: const generics (parameters and arguments)
C-bug
Category: This is a bug.
F-const_generics
`#![feature(const_generics)]`
glacier
ICE tracked in rust-lang/glacier.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I am writing my own little math library to learn rust. I was successful in implementing a mathematical vector type which uses a const generic parameter to specify its dimension/length and stores its values in an array of type
[T; DIM]
under the hood. When trying to implement the same pattern for a matrix that uses a flat array to store its values, I encounter the following error:(Playground)
Errors:
Interestingly, I only get the MIR error message in my full project, but not the
TooGeneric
error, which I put down to having more instances where the type is used therefore triggering monomorphization.When I do not define the generic type but only use
[T; N * M]
directly, I get normal error messages about non-matching types which I expect because of the treatment of this expression as a projection[T; _]
.I suspect this to be another instance of #43408.
The text was updated successfully, but these errors were encountered: