fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.6 KiB48 linesraw
1error: this arithmetic operation will overflow
2  --> $DIR/const-err2.rs:19:13
3   |
4LL |     let a = -i8::MIN;
5   |             ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
6   |
7   = note: `#[deny(arithmetic_overflow)]` on by default
8
9error: this arithmetic operation will overflow
10  --> $DIR/const-err2.rs:21:18
11   |
12LL |     let a_i128 = -i128::MIN;
13   |                  ^^^^^^^^^^ attempt to negate `i128::MIN`, which would overflow
14
15error: this arithmetic operation will overflow
16  --> $DIR/const-err2.rs:23:13
17   |
18LL |     let b = 200u8 + 200u8 + 200u8;
19   |             ^^^^^^^^^^^^^ attempt to compute `200_u8 + 200_u8`, which would overflow
20
21error: this arithmetic operation will overflow
22  --> $DIR/const-err2.rs:25:18
23   |
24LL |     let b_i128 = i128::MIN - i128::MAX;
25   |                  ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN - i128::MAX`, which would overflow
26
27error: this arithmetic operation will overflow
28  --> $DIR/const-err2.rs:27:13
29   |
30LL |     let c = 200u8 * 4;
31   |             ^^^^^^^^^ attempt to compute `200_u8 * 4_u8`, which would overflow
32
33error: this arithmetic operation will overflow
34  --> $DIR/const-err2.rs:29:13
35   |
36LL |     let d = 42u8 - (42u8 + 1);
37   |             ^^^^^^^^^^^^^^^^^ attempt to compute `42_u8 - 43_u8`, which would overflow
38
39error: this operation will panic at runtime
40  --> $DIR/const-err2.rs:31:14
41   |
42LL |     let _e = [5u8][1];
43   |              ^^^^^^^^ index out of bounds: the length is 1 but the index is 1
44   |
45   = note: `#[deny(unconditional_panic)]` on by default
46
47error: aborting due to 7 previous errors
48