mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-28 01:34:21 +00:00
Rollup merge of #71276 - RalfJung:miri-unleash-box, r=ecstatic-morse
miri-unleashed: test that we detect heap allocations This removes the second-to-last use of `IS_SUPPORTED_IN_MIRI = false`. r? @ecstatic-morse @oli-obk
This commit is contained in:
commit
404e06785b
@ -13,7 +13,7 @@ use std::fmt;
|
||||
|
||||
pub use self::qualifs::Qualif;
|
||||
|
||||
pub mod ops;
|
||||
mod ops;
|
||||
pub mod qualifs;
|
||||
mod resolver;
|
||||
pub mod validation;
|
||||
|
@ -113,8 +113,6 @@ impl NonConstOp for FnCallUnstable {
|
||||
#[derive(Debug)]
|
||||
pub struct HeapAllocation;
|
||||
impl NonConstOp for HeapAllocation {
|
||||
const IS_SUPPORTED_IN_MIRI: bool = false;
|
||||
|
||||
fn emit_error(&self, item: &Item<'_, '_>, span: Span) {
|
||||
let mut err = struct_span_err!(
|
||||
item.tcx.sess,
|
||||
|
14
src/test/ui/consts/miri_unleashed/box.rs
Normal file
14
src/test/ui/consts/miri_unleashed/box.rs
Normal file
@ -0,0 +1,14 @@
|
||||
// compile-flags: -Zunleash-the-miri-inside-of-you
|
||||
#![feature(const_mut_refs, box_syntax)]
|
||||
#![deny(const_err)]
|
||||
|
||||
use std::mem::ManuallyDrop;
|
||||
|
||||
fn main() {}
|
||||
|
||||
static TEST_BAD: &mut i32 = {
|
||||
&mut *(box 0)
|
||||
//~^ WARN skipping const check
|
||||
//~| ERROR could not evaluate static initializer
|
||||
//~| NOTE heap allocations
|
||||
};
|
15
src/test/ui/consts/miri_unleashed/box.stderr
Normal file
15
src/test/ui/consts/miri_unleashed/box.stderr
Normal file
@ -0,0 +1,15 @@
|
||||
warning: skipping const checks
|
||||
--> $DIR/box.rs:10:11
|
||||
|
|
||||
LL | &mut *(box 0)
|
||||
| ^^^^^^^
|
||||
|
||||
error[E0080]: could not evaluate static initializer
|
||||
--> $DIR/box.rs:10:11
|
||||
|
|
||||
LL | &mut *(box 0)
|
||||
| ^^^^^^^ "heap allocations via `box` keyword" needs an rfc before being allowed inside constants
|
||||
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0080`.
|
Loading…
Reference in New Issue
Block a user