]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/alloc/stack_free.rs
organize compile-fail tests in folders
[rust.git] / tests / compile-fail / alloc / stack_free.rs
1 // Validation/SB changes why we fail
2 // compile-flags: -Zmiri-disable-validation -Zmiri-disable-stacked-borrows
3
4 // error-pattern: deallocating stack variable memory using Rust heap deallocation operation
5
6 fn main() {
7     let x = 42;
8     let bad_box = unsafe { std::mem::transmute::<&i32, Box<i32>>(&x) };
9     drop(bad_box);
10 }