rust/tests/compile-fail/stack_free.rs

8 lines
199 B
Rust
Raw Normal View History

2017-07-13 12:10:14 -05:00
// error-pattern: tried to deallocate Stack memory but gave Rust as the kind
fn main() {
let x = 42;
let bad_box = unsafe { std::mem::transmute::<&i32, Box<i32>>(&x) };
2017-07-13 12:10:14 -05:00
drop(bad_box);
}