2019-04-30 13:18:29 -05:00
|
|
|
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;
|
2022-07-13 17:59:33 -05:00
|
|
|
unsafe { *y = 2 }; //~ ERROR: /not granting access .* because incompatible item .* is protected/
|
2019-04-30 13:18:29 -05:00
|
|
|
return *a;
|
|
|
|
}
|