Closed
Description
I was messing with macros and came across the error message "error: no type for local variable 10 [E0513]
". The following code will reproduce the error using the Rust playground, on Stable, Beta, and Nightly channels:
fn main() {
let v: usize = 2;
let x: [i32; v] = [0, 1];
}
I would have expected an error message such as "expected constant expression, found non-constant expression." It looks like an easy fix, but I imagine E0513 can occur in other situations as well. Replacing let v: usize
in the above code sample with const v: usize
will compile and run just fine.