6 // This should not be a constant evaluation error (overflow). The value of
7 // `Self::A` must not be assumed to hold inside the trait.
8 const B: u8 = Self::A + 1;
9 //~^ ERROR any use of this value will cause an error
10 //~| WARN this was previously accepted by the compiler but is being phased out
13 // An impl that doesn't override any constant will NOT cause a const eval error
14 // just because it's defined, but only if the bad constant is used anywhere.
15 // This matches the behavior without defaults.
18 // An impl that overrides either constant with a suitable value will be fine.
33 assert_eq!(<() as Tr>::A, 255);
34 assert_eq!(<() as Tr>::B, 0); // causes the error above
35 //~^ ERROR evaluation of constant value failed
36 //~| ERROR erroneous constant used
37 //~| WARN this was previously accepted by the compiler but is being phased out
39 assert_eq!(<u8 as Tr>::A, 254);
40 assert_eq!(<u8 as Tr>::B, 255);
42 assert_eq!(<u16 as Tr>::A, 255);
43 assert_eq!(<u16 as Tr>::B, 0);
45 assert_eq!(<u32 as Tr>::A, 254);
46 assert_eq!(<u32 as Tr>::B, 0);