2019-12-14 03:28:32 +00:00
|
|
|
// build-fail
|
|
|
|
|
2018-05-11 12:33:37 +00:00
|
|
|
#![warn(const_err)]
|
2018-04-08 20:26:28 +00:00
|
|
|
|
2018-01-25 13:15:12 +00:00
|
|
|
const X: u32 = 5;
|
|
|
|
const Y: u32 = 6;
|
2018-03-06 11:43:02 +00:00
|
|
|
const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
|
2018-08-26 13:19:34 +00:00
|
|
|
//~^ WARN any use of this value will cause an error
|
2021-01-30 13:49:22 +00:00
|
|
|
//~| WARN this was previously accepted by the compiler but is being phased out
|
2018-01-25 13:15:12 +00:00
|
|
|
|
|
|
|
fn main() {
|
2018-04-08 20:26:28 +00:00
|
|
|
println!("{}", FOO);
|
2021-03-30 14:26:40 +00:00
|
|
|
//~^ ERROR evaluation of constant value failed
|
2020-01-08 20:31:08 +00:00
|
|
|
//~| WARN erroneous constant used [const_err]
|
2021-01-30 13:49:22 +00:00
|
|
|
//~| WARN this was previously accepted by the compiler but is being phased out
|
2018-01-25 13:15:12 +00:00
|
|
|
}
|