]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-eval/conditional_array_execution.rs
Rollup merge of #72209 - Nemo157:lint-no-mangle-in-unsafe-code, r=nikomatsakis
[rust.git] / src / test / ui / consts / const-eval / conditional_array_execution.rs
1 // build-fail
2
3 #![warn(const_err)]
4
5 const X: u32 = 5;
6 const Y: u32 = 6;
7 const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
8 //~^ WARN any use of this value will cause an error
9 //~| WARN this was previously accepted by the compiler but is being phased out
10
11 fn main() {
12     println!("{}", FOO);
13     //~^ ERROR
14     //~| WARN erroneous constant used [const_err]
15     //~| WARN this was previously accepted by the compiler but is being phased out
16 }