]>
Commit | Line | Data |
---|---|---|
dfeec247 | 1 | // build-fail |
3157f602 XL |
2 | // compile-flags: -Zforce-overflow-checks=on |
3 | ||
74b04a01 | 4 | #![allow(arithmetic_overflow)] |
a1dfa0c6 | 5 | #![warn(const_err)] |
b039eaaf SL |
6 | |
7 | fn black_box<T>(_: T) { | |
8 | unimplemented!() | |
9 | } | |
10 | ||
a7813a04 | 11 | const FOO: u8 = [5u8][1]; |
a1dfa0c6 | 12 | //~^ WARN any use of this value will cause an error |
5869c6ff | 13 | //~| WARN this was previously accepted by the compiler but is being phased out |
a7813a04 | 14 | |
b039eaaf | 15 | fn main() { |
a7813a04 | 16 | black_box((FOO, FOO)); |
a1dfa0c6 | 17 | //~^ ERROR erroneous constant used |
48663c56 | 18 | //~| ERROR erroneous constant |
b039eaaf | 19 | } |