//@ build-fail //@ revisions: normal mir-opt //@ [mir-opt]compile-flags: -Zmir-opt-level=4 trait C { const BOO: usize; } trait Foo { const BAR: usize; } struct A(T); impl Foo for A { const BAR: usize = [5, 6, 7][T::BOO]; //~ ERROR evaluation of ` as Foo<()>>::BAR` failed } fn foo() -> &'static usize { & as Foo>::BAR //~ constant } impl C for () { const BOO: usize = 42; } impl C for u32 { const BOO: usize = 1; } fn main() { println!("{:x}", foo::<()>() as *const usize as usize); println!("{:x}", foo::() as *const usize as usize); println!("{:x}", foo::<()>()); println!("{:x}", foo::()); }