add arielby's example

This commit is contained in:
Ralf Jung 2019-04-30 20:18:29 +02:00
parent 784233573f
commit 617195eb12

View File

@ -0,0 +1,12 @@
fn main() {
let x = &mut 0u32;
let p = x as *mut u32;
foo(x, p);
}
fn foo(a: &mut u32, y: *mut u32) -> u32 {
*a = 1;
let _b = &*a;
unsafe { *y = 2; } //~ ERROR: borrow stack
return *a;
}