2018-10-23 09:01:22 -05:00
|
|
|
// Make sure that we cannot pass by argument a `&` that got already invalidated.
|
|
|
|
fn foo(_: &i32) {}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let x = &mut 42;
|
2018-11-22 09:26:06 -06:00
|
|
|
let xraw = x as *mut _;
|
2018-10-23 09:01:22 -05:00
|
|
|
let xref = unsafe { &*xraw };
|
2018-11-09 03:53:28 -06:00
|
|
|
unsafe { *xraw = 42 }; // unfreeze
|
|
|
|
foo(xref); //~ ERROR is not frozen
|
2018-10-23 09:01:22 -05:00
|
|
|
}
|