blob: 5f8a1988b3c1034fe297b87ec18ba0dd32cc06ad [file] [log] [blame]
// This should fail even without validation
//@compile-flags: -Zmiri-disable-validation
unsafe fn make_ref<'a>(x: *mut i32) -> &'a mut i32 {
&mut *x
}
fn main() {
unsafe {
let x = make_ref(&mut 0); // The temporary storing "0" is deallocated at the ";"!
let val = *x; //~ ERROR: has been freed
println!("{}", val);
}
}