2018-10-19 11:38:23 -05:00
|
|
|
fn main() {
|
2018-10-22 11:01:32 -05:00
|
|
|
let target = Box::new(42); // has an implicit raw
|
2018-11-15 12:49:00 -06:00
|
|
|
let xref = &*target;
|
|
|
|
{
|
2022-06-21 13:38:02 -05:00
|
|
|
let x: *mut u32 = xref as *const _ as *mut _;
|
2022-06-25 22:30:29 -05:00
|
|
|
unsafe { *x = 42 }; // invalidates shared ref, activates raw
|
2018-11-15 12:49:00 -06:00
|
|
|
}
|
2019-04-16 10:17:28 -05:00
|
|
|
let _x = *xref; //~ ERROR borrow stack
|
2018-10-19 11:38:23 -05:00
|
|
|
}
|