]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-err.rs
Rollup merge of #64603 - gilescope:unused-lifetime-warning, r=matthewjasper
[rust.git] / src / test / ui / consts / const-err.rs
1 // compile-flags: -Zforce-overflow-checks=on
2
3 #![allow(exceeding_bitshifts)]
4 #![warn(const_err)]
5
6 fn black_box<T>(_: T) {
7     unimplemented!()
8 }
9
10 const FOO: u8 = [5u8][1];
11 //~^ WARN any use of this value will cause an error
12
13 fn main() {
14     black_box((FOO, FOO));
15     //~^ ERROR erroneous constant used
16     //~| ERROR erroneous constant
17 }