Do not run const prop on the mir_for_ctfe of const fn

This commit is contained in:
oli 2021-01-04 19:05:51 +00:00
parent 409195d4e5
commit 65ee418e5c
4 changed files with 39 additions and 22 deletions

View file

@ -1,6 +1,8 @@
// check-pass
// compile-flags: --crate-type lib
// need to emit MIR, because const prop (which emits `unconditional_panic`) only runs if
// the `optimized_mir` query is run, which it isn't in check-only mode.
// compile-flags: --crate-type lib --emit=mir,link
#![warn(unconditional_panic)]

View file

@ -1,11 +1,11 @@
warning: this operation will panic at runtime
--> $DIR/ice-assert-fail-div-by-zero.rs:11:5
--> $DIR/ice-assert-fail-div-by-zero.rs:13:5
|
LL | f.0 / 0;
| ^^^^^^^ attempt to divide `_` by zero
|
note: the lint level is defined here
--> $DIR/ice-assert-fail-div-by-zero.rs:5:9
--> $DIR/ice-assert-fail-div-by-zero.rs:7:9
|
LL | #![warn(unconditional_panic)]
| ^^^^^^^^^^^^^^^^^^^

View file

@ -4,7 +4,7 @@ error: any use of this value will cause an error
LL | const X: u64 = *wat(42);
| ---------------^^^^^^^^-
| |
| pointer to alloc2 was dereferenced after this allocation got freed
| pointer to alloc1 was dereferenced after this allocation got freed
|
= note: `#[deny(const_err)]` on by default