rust/tests/fail/validity/dangling_ref1.rs

8 lines
263 B
Rust
Raw Normal View History

// Make sure we catch this even without Stacked Borrows
2022-07-08 11:08:32 -05:00
//@compile-flags: -Zmiri-disable-stacked-borrows
2018-10-19 11:38:23 -05:00
use std::mem;
fn main() {
let _x: &i32 = unsafe { mem::transmute(16usize) }; //~ ERROR: encountered a dangling reference (address 0x10 is unallocated)
2018-10-19 11:38:23 -05:00
}