2019-04-30 20:18:29 +02: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-06-21 11:38:02 -07:00
|
|
|
unsafe {
|
2022-06-21 11:40:02 -07:00
|
|
|
*y = 2; //~ ERROR: not granting access to tag
|
|
|
|
}
|
2019-04-30 20:18:29 +02:00
|
|
|
return *a;
|
|
|
|
}
|