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