rust/tests/compile-fail/stacked_borrows/illegal_write3.rs
Ralf Jung ef52be031c adjust compile-fail error messages
This also passes miri-test-libstd!
2019-04-17 16:02:57 +02:00

9 lines
311 B
Rust

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 borrow stack
let _val = *r#ref;
}