2018-10-17 09:55:59 -05:00
|
|
|
fn main() {
|
|
|
|
let target = &mut 42;
|
|
|
|
let target2 = target as *mut _;
|
|
|
|
drop(&mut *target); // reborrow
|
2018-10-22 11:01:32 -05:00
|
|
|
// Now make sure our ref is still the only one.
|
2022-06-21 13:38:02 -05:00
|
|
|
unsafe {
|
2022-06-21 13:40:02 -05:00
|
|
|
*target2 = 13; //~ ERROR borrow stack
|
|
|
|
}
|
2018-10-22 11:01:32 -05:00
|
|
|
let _val = *target;
|
2018-10-17 09:55:59 -05:00
|
|
|
}
|