rust/tests/compile-fail/stack_free.rs
2020-02-24 16:22:02 +01:00

11 lines
325 B
Rust

// Validation/SB changes why we fail
// compile-flags: -Zmiri-disable-validation -Zmiri-disable-stacked-borrows
// error-pattern: tried to deallocate `Stack` memory but gave `Machine(Rust)` as the kind
fn main() {
let x = 42;
let bad_box = unsafe { std::mem::transmute::<&i32, Box<i32>>(&x) };
drop(bad_box);
}