summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/const-eval/issue-43197.rs
blob: e15f8771dd73b1ff63cae00a4f2b32384288411a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// build-fail

#![warn(const_err)]

const fn foo(x: u32) -> u32 {
    x
}

fn main() {
    const X: u32 = 0 - 1;
    //~^ WARN any use of this value will cause
    //~| WARN this was previously accepted by the compiler but is being phased out
    const Y: u32 = foo(0 - 1);
    //~^ WARN any use of this value will cause
    //~| WARN this was previously accepted by the compiler but is being phased out
    println!("{} {}", X, Y);
    //~^ ERROR evaluation of constant value failed
    //~| ERROR evaluation of constant value failed
    //~| WARN erroneous constant used [const_err]
    //~| WARN erroneous constant used [const_err]
    //~| WARN this was previously accepted by the compiler but is being phased out
    //~| WARN this was previously accepted by the compiler but is being phased out
}