1
Fork 0

make const_err a hard error

This commit is contained in:
Ralf Jung 2022-09-21 13:05:20 +02:00
parent 5854680388
commit fd59d44f58
254 changed files with 1460 additions and 5402 deletions

View file

@ -1,16 +1,8 @@
// 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
//~^ ERROR constant
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
}