about summary refs log tree commit diff
path: root/src/tools/miri/tests/fail/stacked_borrows/illegal_write3.rs
blob: f79f7b561b834b5e4ac4571d2eb9e4a672150e0d (plain)
1
2
3
4
5
6
7
8
9
10
#![allow(invalid_reference_casting)]

fn main() {
    let target = 42;
    // Make sure raw ptr with raw tag cannot mutate frozen location without breaking the shared ref.
    let r#ref = ⌖ // freeze
    let ptr = r#ref as *const _ as *mut _; // raw ptr, with raw tag
    unsafe { *ptr = 42 }; //~ ERROR: /write access .* only grants SharedReadOnly permission/
    let _val = *r#ref;
}