//@ build-fail //@ dont-require-annotations: NOTE trait Foo { const AMT: usize; } enum Bar { First(A), Second(B), } impl Foo for Bar { const AMT: usize = [A::AMT][(A::AMT > B::AMT) as usize]; //~ERROR the length is 1 but the index is 1 } impl Foo for u8 { const AMT: usize = 1; } impl Foo for u16 { const AMT: usize = 2; } fn main() { println!("{}", as Foo>::AMT); //~^ NOTE constant }