#![allow(const_err)] 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]; } impl Foo for u8 { const AMT: usize = 1; } impl Foo for u16 { const AMT: usize = 2; } fn main() { println!("{}", as Foo>::AMT); //~^ ERROR E0080 }