2018-11-03 10:23:41 +01: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 16:55:59 +02:00
|
|
|
#![allow(unused_variables)]
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let target = &mut 42;
|
|
|
|
let target2 = target as *mut _;
|
|
|
|
drop(&mut *target); // reborrow
|
2018-10-22 18:01:32 +02: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 16:55:59 +02:00
|
|
|
}
|