Closed
Description
Spawned off of #5873
use self::Category::*;
enum Category {
A,
B,
C,
NumCategories,
}
const NUM_CATEGORIES: usize = NumCategories as usize;
fn main() {
let the_categories: [Category; NUM_CATEGORIES] = [A, B, C];
println!("{:?}", the_categories);
}
<anon>:9:31: 9:44 error: array length constant evaluation error: non-constant path in constant expr [E0250]
<anon>:9 const NUM_CATEGORIES: usize = NumCategories as usize;
^~~~~~~~~~~~~
<anon>:12:25: 12:51 note: for array length here
<anon>:12 let the_categories: [Category; NUM_CATEGORIES] = [A, B, C];
^~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error