]> git.lizzy.rs Git - rust.git/blob - tests/fail/stacked_borrows/illegal_write3.rs
pointer tag tracking: on creation, log the offsets it is created for
[rust.git] / tests / fail / stacked_borrows / illegal_write3.rs
1 fn main() {
2     let target = 42;
3     // Make sure raw ptr with raw tag cannot mutate frozen location without breaking the shared ref.
4     let r#ref = ⌖ // freeze
5     let ptr = r#ref as *const _ as *mut _; // raw ptr, with raw tag
6     unsafe { *ptr = 42 }; //~ ERROR only grants SharedReadOnly permission
7     let _val = *r#ref;
8 }