2018-10-23 16:01:22 +02: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 16:26:06 +01:00
|
|
|
let xraw = x as *mut _;
|
2018-10-23 16:01:22 +02:00
|
|
|
let xref = unsafe { &*xraw };
|
2018-11-09 10:53:28 +01:00
|
|
|
unsafe { *xraw = 42 }; // unfreeze
|
2019-04-16 17:17:28 +02:00
|
|
|
foo(xref); //~ ERROR borrow stack
|
2018-10-23 16:01:22 +02:00
|
|
|
}
|