rust/src/test/ui/consts/const-err2.opt_with_overflow_checks.stderr

49 lines
1.4 KiB
Plaintext
Raw Normal View History

error: this arithmetic operation will overflow
--> $DIR/const-err2.rs:19:13
2018-08-08 07:28:26 -05:00
|
2019-09-01 13:06:11 -05:00
LL | let a = -std::i8::MIN;
2019-09-01 15:01:39 -05:00
| ^^^^^^^^^^^^^ attempt to negate with overflow
2018-08-08 07:28:26 -05:00
|
= note: `#[deny(overflow)]` on by default
2018-08-08 07:28:26 -05:00
error: this arithmetic operation will overflow
--> $DIR/const-err2.rs:21:18
|
LL | let a_i128 = -std::i128::MIN;
| ^^^^^^^^^^^^^^^ attempt to negate with overflow
error: this arithmetic operation will overflow
--> $DIR/const-err2.rs:23:13
2019-09-01 13:06:11 -05:00
|
LL | let b = 200u8 + 200u8 + 200u8;
2019-09-01 15:01:39 -05:00
| ^^^^^^^^^^^^^ attempt to add with overflow
2019-09-01 13:06:11 -05:00
error: this arithmetic operation will overflow
--> $DIR/const-err2.rs:25:18
|
LL | let b_i128 = std::i128::MIN - std::i128::MAX;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to subtract with overflow
error: this arithmetic operation will overflow
--> $DIR/const-err2.rs:27:13
2019-09-01 13:06:11 -05:00
|
LL | let c = 200u8 * 4;
2019-09-01 15:01:39 -05:00
| ^^^^^^^^^ attempt to multiply with overflow
2019-09-01 13:06:11 -05:00
error: this arithmetic operation will overflow
--> $DIR/const-err2.rs:29:13
2019-09-01 13:06:11 -05:00
|
LL | let d = 42u8 - (42u8 + 1);
2019-09-01 15:01:39 -05:00
| ^^^^^^^^^^^^^^^^^ attempt to subtract with overflow
2019-09-01 13:06:11 -05:00
error: this operation will panic at runtime
--> $DIR/const-err2.rs:31:14
2019-09-01 13:06:11 -05:00
|
LL | let _e = [5u8][1];
| ^^^^^^^^ index out of bounds: the len is 1 but the index is 1
|
= note: `#[deny(panic)]` on by default
2019-09-01 13:06:11 -05:00
error: aborting due to 7 previous errors
2018-08-08 07:28:26 -05:00