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