summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/const-eval/conditional_array_execution.rs
blob: bd517e568eae91bc20e08fb3b045394a7ddb2c84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// build-fail

#![warn(const_err)]

const X: u32 = 5;
const Y: u32 = 6;
const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
//~^ WARN any use of this value will cause an error
//~| WARN this was previously accepted by the compiler but is being phased out

fn main() {
    println!("{}", FOO);
    //~^ ERROR evaluation of constant value failed
    //~| WARN erroneous constant used [const_err]
    //~| WARN this was previously accepted by the compiler but is being phased out
}