rust/tests/compile-fail/stack_free.rs

6 lines
190 B
Rust

fn main() {
let x = 42;
let bad_box = unsafe { std::mem::transmute::<&i32, Box<i32>>(&x) };
drop(bad_box); //~ ERROR tried to deallocate Stack memory but gave Rust as the kind
}