Skip to content

Commit 617195e

Browse files
committed
add arielby's example
1 parent 7842335 commit 617195e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
fn main() {
2+
let x = &mut 0u32;
3+
let p = x as *mut u32;
4+
foo(x, p);
5+
}
6+
7+
fn foo(a: &mut u32, y: *mut u32) -> u32 {
8+
*a = 1;
9+
let _b = &*a;
10+
unsafe { *y = 2; } //~ ERROR: borrow stack
11+
return *a;
12+
}

0 commit comments

Comments
 (0)