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