Part of #68490. Care has been taken to leave the old consts where appropriate, for testing backcompat regressions, module shadowing, etc. The intrinsics docs were accidentally referring to some methods on f64 as std::f64, which I changed due to being contrary with how we normally disambiguate the shadow module from the primitive. In one other place I changed std::u8 to std::ops since it was just testing path handling in macros. For places which have legitimate uses of the old consts, deprecated attributes have been optimistically inserted. Although currently unnecessary, they exist to emphasize to any future deprecation effort the necessity of these specific symbols and prevent them from being accidentally removed.
48 lines
1.6 KiB
Text
48 lines
1.6 KiB
Text
error: this arithmetic operation will overflow
|
|
--> $DIR/const-err2.rs:19:13
|
|
|
|
|
LL | let a = -i8::MIN;
|
|
| ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
|
|
|
|
|
= note: `#[deny(arithmetic_overflow)]` on by default
|
|
|
|
error: this arithmetic operation will overflow
|
|
--> $DIR/const-err2.rs:21:18
|
|
|
|
|
LL | let a_i128 = -i128::MIN;
|
|
| ^^^^^^^^^^ attempt to negate `i128::MIN`, which would overflow
|
|
|
|
error: this arithmetic operation will overflow
|
|
--> $DIR/const-err2.rs:23:13
|
|
|
|
|
LL | let b = 200u8 + 200u8 + 200u8;
|
|
| ^^^^^^^^^^^^^ attempt to compute `200_u8 + 200_u8`, which would overflow
|
|
|
|
error: this arithmetic operation will overflow
|
|
--> $DIR/const-err2.rs:25:18
|
|
|
|
|
LL | let b_i128 = i128::MIN - i128::MAX;
|
|
| ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN - i128::MAX`, which would overflow
|
|
|
|
error: this arithmetic operation will overflow
|
|
--> $DIR/const-err2.rs:27:13
|
|
|
|
|
LL | let c = 200u8 * 4;
|
|
| ^^^^^^^^^ attempt to compute `200_u8 * 4_u8`, which would overflow
|
|
|
|
error: this arithmetic operation will overflow
|
|
--> $DIR/const-err2.rs:29:13
|
|
|
|
|
LL | let d = 42u8 - (42u8 + 1);
|
|
| ^^^^^^^^^^^^^^^^^ attempt to compute `42_u8 - 43_u8`, which would overflow
|
|
|
|
error: this operation will panic at runtime
|
|
--> $DIR/const-err2.rs:31:14
|
|
|
|
|
LL | let _e = [5u8][1];
|
|
| ^^^^^^^^ index out of bounds: the length is 1 but the index is 1
|
|
|
|
|
= note: `#[deny(unconditional_panic)]` on by default
|
|
|
|
error: aborting due to 7 previous errors
|
|
|