2022-07-08 11:08:32 -05:00
|
|
|
//@compile-flags: -Zmiri-permissive-provenance
|
2022-06-26 20:26:14 -05:00
|
|
|
|
2018-10-22 11:01:32 -05:00
|
|
|
// Make sure we cannot use raw ptrs to access a local that
|
2018-11-07 07:56:25 -06:00
|
|
|
// we took the direct address of.
|
2018-10-22 11:01:32 -05:00
|
|
|
fn main() {
|
|
|
|
let mut x = 42;
|
2018-11-07 07:56:25 -06:00
|
|
|
let raw = &mut x as *mut i32 as usize as *mut i32;
|
|
|
|
let _ptr = &mut x;
|
2022-06-21 13:38:02 -05:00
|
|
|
unsafe {
|
2022-07-11 06:44:55 -05:00
|
|
|
*raw = 13; //~ ERROR: borrow stack
|
2022-06-21 13:40:02 -05:00
|
|
|
}
|
2018-10-22 11:01:32 -05:00
|
|
|
}
|