fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #69854 - pietroalbini:stable-next, r=Centrilb8cedc00407

1.42.0
1.4 KiB49 linesraw
1warning: any use of this value will cause an error
2  --> $DIR/issue-43197.rs:10:20
3   |
4LL |     const X: u32 = 0 - 1;
5   |     ---------------^^^^^-
6   |                    |
7   |                    attempt to subtract with overflow
8   |
9note: lint level defined here
10  --> $DIR/issue-43197.rs:3:9
11   |
12LL | #![warn(const_err)]
13   |         ^^^^^^^^^
14
15warning: any use of this value will cause an error
16  --> $DIR/issue-43197.rs:12:24
17   |
18LL |     const Y: u32 = foo(0 - 1);
19   |     -------------------^^^^^--
20   |                        |
21   |                        attempt to subtract with overflow
22
23error[E0080]: evaluation of constant expression failed
24  --> $DIR/issue-43197.rs:14:23
25   |
26LL |     println!("{} {}", X, Y);
27   |                       ^ referenced constant has errors
28
29warning: erroneous constant used
30  --> $DIR/issue-43197.rs:14:23
31   |
32LL |     println!("{} {}", X, Y);
33   |                       ^ referenced constant has errors
34
35error[E0080]: evaluation of constant expression failed
36  --> $DIR/issue-43197.rs:14:26
37   |
38LL |     println!("{} {}", X, Y);
39   |                          ^ referenced constant has errors
40
41warning: erroneous constant used
42  --> $DIR/issue-43197.rs:14:26
43   |
44LL |     println!("{} {}", X, Y);
45   |                          ^ referenced constant has errors
46
47error: aborting due to 2 previous errors
48
49For more information about this error, try `rustc --explain E0080`.