]> git.lizzy.rs Git - rust.git/blob - src/tools/miri/tests/fail/erroneous_const2.rs
Rollup merge of #101642 - SkiFire13:fix-inplace-collection-leak, r=the8472
[rust.git] / src / tools / miri / tests / fail / erroneous_const2.rs
1 const X: u32 = 5;
2 const Y: u32 = 6;
3 const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
4 //~^ERROR: any use of this value
5 //~|WARN: previously accepted
6
7 #[rustfmt::skip] // rustfmt bug: https://github.com/rust-lang/rustfmt/issues/5391
8 fn main() {
9     println!("{}", FOO); //~ERROR: post-monomorphization error
10     //~|ERROR: evaluation of constant value failed
11     //~|ERROR: erroneous constant used
12     //~|WARN: previously accepted
13 }