blob: 92f273f67bb22984ad9bc82f16cd7d171f1d7b47 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
//@revisions: stack tree
//@[tree]compile-flags: -Zmiri-tree-borrows
#![allow(invalid_reference_casting)]
fn main() {
let target = Box::new(42); // has an implicit raw
let xref = &*target;
{
let x: *mut u32 = xref as *const _ as *mut _;
unsafe { *x = 42 };
//~[stack]^ ERROR: /write access .* tag only grants SharedReadOnly permission/
//~[tree]| ERROR: /write access through .* is forbidden/
}
let _x = *xref;
}
|