We don't look into static items anymore during const prop

This commit is contained in:
Oli Scherer 2024-01-08 09:41:48 +00:00
parent 6b359b7e1b
commit 0b6cf3b78c
2 changed files with 2 additions and 9 deletions

View File

@ -33,7 +33,6 @@ fn main() {
INT_MIN % NEG_ONE; INT_MIN % NEG_ONE;
//~^ ERROR: this operation will panic at runtime //~^ ERROR: this operation will panic at runtime
//~| ERROR: any number modulo -1 will panic/overflow or result in 0 //~| ERROR: any number modulo -1 will panic/overflow or result in 0
// ONLY caught by rustc // Not caught by lint, we don't look into static items, even if entirely immutable.
INT_MIN % STATIC_NEG_ONE; INT_MIN % STATIC_NEG_ONE;
//~^ ERROR: this operation will panic at runtime
} }

View File

@ -12,12 +12,6 @@ error: this operation will panic at runtime
LL | INT_MIN % NEG_ONE; LL | INT_MIN % NEG_ONE;
| ^^^^^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow | ^^^^^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow
error: this operation will panic at runtime
--> $DIR/modulo_one.rs:37:5
|
LL | INT_MIN % STATIC_NEG_ONE;
| ^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow
error: any number modulo 1 will be 0 error: any number modulo 1 will be 0
--> $DIR/modulo_one.rs:8:5 --> $DIR/modulo_one.rs:8:5
| |
@ -57,5 +51,5 @@ error: any number modulo -1 will panic/overflow or result in 0
LL | INT_MIN % NEG_ONE; LL | INT_MIN % NEG_ONE;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: aborting due to 9 previous errors error: aborting due to 8 previous errors