blob: 986dd18b2e0b4e1c1467c1bf68e1f9c69d4b2574 [file] [log] [blame]
// Make sure that we cannot return a `&` that got already invalidated.
fn foo(x: &mut (i32, i32)) -> &i32 {
let xraw = x as *mut (i32, i32);
let ret = unsafe { &(*xraw).1 };
unsafe { *xraw = (42, 23) }; // unfreeze
ret //~ ERROR is not frozen
}
fn main() {
foo(&mut (1, 2));
}