2020-04-14 03:03:10 -05:00
|
|
|
// 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 val = 14;
|
|
|
|
let ptr = (&val as *const i32).wrapping_offset(1);
|
2022-07-11 06:44:55 -05:00
|
|
|
let _x: &i32 = unsafe { mem::transmute(ptr) }; //~ ERROR: dangling reference (going beyond the bounds of its allocation)
|
2018-10-19 11:38:23 -05:00
|
|
|
}
|