summaryrefslogtreecommitdiff
path: root/src/tools/miri/tests/fail/alloc/stack_free.rs
blob: baf53decc4413874d71f192bbfea5cce14a0178a (plain)
1
2
3
4
5
6
7
8
9
10
// Validation/SB changes why we fail
//@compile-flags: -Zmiri-disable-validation -Zmiri-disable-stacked-borrows

//@error-pattern: /deallocating .*, which is stack variable memory, using Rust heap deallocation operation/

fn main() {
    let x = 42;
    let bad_box = unsafe { std::mem::transmute::<&i32, Box<i32>>(&x) };
    drop(bad_box);
}