]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-err3.rs
move interface to the unikernel in the crate hermit-abi
[rust.git] / src / test / ui / consts / const-err3.rs
1 // needed because negating int::MIN will behave differently between
2 // optimized compilation and unoptimized compilation and thus would
3 // lead to different lints being emitted
4 // compile-flags: -C overflow-checks=on -O
5
6 #![feature(rustc_attrs)]
7 #![allow(exceeding_bitshifts)]
8
9 #![deny(const_err)]
10
11 fn black_box<T>(_: T) {
12     unimplemented!()
13 }
14
15 fn main() {
16     let a = -std::i8::MIN;
17     //~^ ERROR const_err
18     let b = 200u8 + 200u8 + 200u8;
19     //~^ ERROR const_err
20     let c = 200u8 * 4;
21     //~^ ERROR const_err
22     let d = 42u8 - (42u8 + 1);
23     //~^ ERROR const_err
24     let _e = [5u8][1];
25     //~^ ERROR const_err
26     black_box(a);
27     black_box(b);
28     black_box(c);
29     black_box(d);
30 }