]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-eval/issue-43197.rs
Auto merge of #81821 - nikic:update-wasm32, r=sanxiyn
[rust.git] / src / test / ui / consts / const-eval / issue-43197.rs
1 // build-fail
2
3 #![warn(const_err)]
4
5 const fn foo(x: u32) -> u32 {
6     x
7 }
8
9 fn main() {
10     const X: u32 = 0 - 1;
11     //~^ WARN any use of this value will cause
12     //~| WARN this was previously accepted by the compiler but is being phased out
13     const Y: u32 = foo(0 - 1);
14     //~^ WARN any use of this value will cause
15     //~| WARN this was previously accepted by the compiler but is being phased out
16     println!("{} {}", X, Y);
17     //~^ ERROR evaluation of constant value failed
18     //~| ERROR evaluation of constant value failed
19     //~| WARN erroneous constant used [const_err]
20     //~| WARN erroneous constant used [const_err]
21     //~| WARN this was previously accepted by the compiler but is being phased out
22     //~| WARN this was previously accepted by the compiler but is being phased out
23 }