2020-02-15 09:47:27 +00:00
|
|
|
error: this arithmetic operation will overflow
|
|
|
|
--> $DIR/const-err2.rs:19:13
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
2020-10-24 23:21:40 +00:00
|
|
|
LL | let a = -i8::MIN;
|
|
|
|
| ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
2020-02-18 21:49:47 +00:00
|
|
|
= note: `#[deny(arithmetic_overflow)]` on by default
|
2018-08-08 12:28:26 +00:00
|
|
|
|
2020-02-15 09:47:27 +00:00
|
|
|
error: this arithmetic operation will overflow
|
|
|
|
--> $DIR/const-err2.rs:21:18
|
2020-02-10 10:37:02 +00:00
|
|
|
|
|
2020-10-24 23:21:40 +00:00
|
|
|
LL | let a_i128 = -i128::MIN;
|
|
|
|
| ^^^^^^^^^^ attempt to negate `i128::MIN`, which would overflow
|
2020-02-10 10:37:02 +00:00
|
|
|
|
2020-02-15 09:47:27 +00:00
|
|
|
error: this arithmetic operation will overflow
|
|
|
|
--> $DIR/const-err2.rs:23:13
|
2019-09-01 18:06:11 +00:00
|
|
|
|
|
|
|
|
LL | let b = 200u8 + 200u8 + 200u8;
|
2020-09-15 19:34:50 +00:00
|
|
|
| ^^^^^^^^^^^^^ attempt to compute `200_u8 + 200_u8`, which would overflow
|
2019-09-01 18:06:11 +00:00
|
|
|
|
2020-02-15 09:47:27 +00:00
|
|
|
error: this arithmetic operation will overflow
|
|
|
|
--> $DIR/const-err2.rs:25:18
|
2020-02-10 10:37:02 +00:00
|
|
|
|
|
2020-10-24 23:21:40 +00:00
|
|
|
LL | let b_i128 = i128::MIN - i128::MAX;
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN - i128::MAX`, which would overflow
|
2020-02-10 10:37:02 +00:00
|
|
|
|
2020-02-15 09:47:27 +00:00
|
|
|
error: this arithmetic operation will overflow
|
|
|
|
--> $DIR/const-err2.rs:27:13
|
2019-09-01 18:06:11 +00:00
|
|
|
|
|
|
|
|
LL | let c = 200u8 * 4;
|
2020-09-15 19:34:50 +00:00
|
|
|
| ^^^^^^^^^ attempt to compute `200_u8 * 4_u8`, which would overflow
|
2019-09-01 18:06:11 +00:00
|
|
|
|
2020-02-15 09:47:27 +00:00
|
|
|
error: this arithmetic operation will overflow
|
|
|
|
--> $DIR/const-err2.rs:29:13
|
2019-09-01 18:06:11 +00:00
|
|
|
|
|
|
|
|
LL | let d = 42u8 - (42u8 + 1);
|
2020-09-15 19:34:50 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^ attempt to compute `42_u8 - 43_u8`, which would overflow
|
2019-09-01 18:06:11 +00:00
|
|
|
|
2020-02-15 09:47:27 +00:00
|
|
|
error: this operation will panic at runtime
|
|
|
|
--> $DIR/const-err2.rs:31:14
|
2019-09-01 18:06:11 +00:00
|
|
|
|
|
|
|
|
LL | let _e = [5u8][1];
|
2020-09-15 19:34:50 +00:00
|
|
|
| ^^^^^^^^ index out of bounds: the length is 1 but the index is 1
|
2020-02-15 09:47:27 +00:00
|
|
|
|
|
2020-02-18 21:49:47 +00:00
|
|
|
= note: `#[deny(unconditional_panic)]` on by default
|
2019-09-01 18:06:11 +00:00
|
|
|
|
2020-02-10 10:37:02 +00:00
|
|
|
error: aborting due to 7 previous errors
|
2018-08-08 12:28:26 +00:00
|
|
|
|