]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-eval/issue-43197.rs
Rollup merge of #81630 - GuillaumeGomez:overflow-sidebar-title-text, r=pickfire
[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     const Y: u32 = foo(0 - 1);
13     //~^ WARN any use of this value will cause
14     println!("{} {}", X, Y);
15     //~^ ERROR evaluation of constant value failed
16     //~| ERROR evaluation of constant value failed
17     //~| WARN erroneous constant used [const_err]
18     //~| WARN erroneous constant used [const_err]
19 }