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