1 // This should fail even without validation, but some MIR opts mask the error
2 //@compile-flags: -Zmiri-disable-validation -Zmir-opt-level=0 -Zmiri-permissive-provenance
4 static mut LEAK: usize = 0;
8 LEAK = v as *mut _ as usize;
13 unsafe { &mut *(LEAK as *mut i32) }; //~ ERROR: is a dangling pointer
23 // Now we use a pointer to `x` which is no longer in scope, and thus dead (even though the
24 // `main` stack frame still exists). We even try going through a `usize` for extra sneakiness!