]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/stacked_borrows/illegal_write1.rs
adjust compile-fail error messages
[rust.git] / tests / compile-fail / stacked_borrows / illegal_write1.rs
1 fn main() {
2     let target = Box::new(42); // has an implicit raw
3     let xref = &*target;
4     {
5         let x : *mut u32 = xref as *const _ as *mut _;
6         unsafe { *x = 42; } // invalidates shared ref, activates raw
7     }
8     let _x = *xref; //~ ERROR borrow stack
9 }