]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-err2.opt_with_overflow_checks.stderr
2473632cbc804a0e7cc881e4470ddb59e32da507
[rust.git] / src / test / ui / consts / const-err2.opt_with_overflow_checks.stderr
1 error: this arithmetic operation will overflow
2   --> $DIR/const-err2.rs:19:13
3    |
4 LL |     let a = -std::i8::MIN;
5    |             ^^^^^^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
6    |
7    = note: `#[deny(arithmetic_overflow)]` on by default
8
9 error: this arithmetic operation will overflow
10   --> $DIR/const-err2.rs:21:18
11    |
12 LL |     let a_i128 = -std::i128::MIN;
13    |                  ^^^^^^^^^^^^^^^ attempt to negate `i128::MIN`, which would overflow
14
15 error: this arithmetic operation will overflow
16   --> $DIR/const-err2.rs:23:13
17    |
18 LL |     let b = 200u8 + 200u8 + 200u8;
19    |             ^^^^^^^^^^^^^ attempt to compute `200_u8 + 200_u8`, which would overflow
20
21 error: this arithmetic operation will overflow
22   --> $DIR/const-err2.rs:25:18
23    |
24 LL |     let b_i128 = std::i128::MIN - std::i128::MAX;
25    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN - i128::MAX`, which would overflow
26
27 error: this arithmetic operation will overflow
28   --> $DIR/const-err2.rs:27:13
29    |
30 LL |     let c = 200u8 * 4;
31    |             ^^^^^^^^^ attempt to compute `200_u8 * 4_u8`, which would overflow
32
33 error: this arithmetic operation will overflow
34   --> $DIR/const-err2.rs:29:13
35    |
36 LL |     let d = 42u8 - (42u8 + 1);
37    |             ^^^^^^^^^^^^^^^^^ attempt to compute `42_u8 - 43_u8`, which would overflow
38
39 error: this operation will panic at runtime
40   --> $DIR/const-err2.rs:31:14
41    |
42 LL |     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
47 error: aborting due to 7 previous errors
48