summary refs log tree commit diff
path: root/src/tools/miri/tests/fail/validity/dangling_ref1.rs
blob: 6bf2d9295a37095962bd9ba340021a0f3e4a3fc2 (plain)
1
2
3
4
5
6
7
// Make sure we catch this even without Stacked Borrows
//@compile-flags: -Zmiri-disable-stacked-borrows
use std::mem;

fn main() {
    let _x: &i32 = unsafe { mem::transmute(16usize) }; //~ ERROR: encountered a dangling reference (address 0x10 is unallocated)
}