2018-11-03 04:23:41 -05:00
|
|
|
// We fail to detect this when neither this nor libstd are optimized/have retagging.
|
|
|
|
// FIXME: Investigate that.
|
|
|
|
// compile-flags: -Zmir-opt-level=0
|
|
|
|
|
2018-10-17 09:55:59 -05:00
|
|
|
#![allow(unused_variables)]
|
|
|
|
|
|
|
|
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.
|
|
|
|
unsafe { *target2 = 13; } //~ ERROR does not exist on the stack
|
|
|
|
let _val = *target;
|
2018-10-17 09:55:59 -05:00
|
|
|
}
|