1 // build-fail
2 
3 trait Unsigned {
4     const MAX: u8;
5 }
6 
7 struct U8(u8);
8 impl Unsigned for U8 {
9     const MAX: u8 = 0xff;
10 }
11 
12 struct Sum<A,B>(A,B);
13 
14 impl<A: Unsigned, B: Unsigned> Unsigned for Sum<A,B> {
15     const MAX: u8 = A::MAX + B::MAX;
16     //~^ ERROR any use of this value will cause an error [const_err]
17     //~| WARN this was previously accepted by the compiler but is being phased out
18 }
19 
foo<T>(_: T) -> &'static u820 fn foo<T>(_: T) -> &'static u8 {
21     &Sum::<U8,U8>::MAX
22     //~^ ERROR E0080
23 }
24 
main()25 fn main() {
26     foo(0);
27 }
28