2018-11-15 19:49:00 +01:00
|
|
|
fn inner(x: *mut i32, _y: &mut i32) {
|
|
|
|
// If `x` and `y` alias, retagging is fine with this... but we really
|
|
|
|
// shouldn't be allowed to use `x` at all because `y` was assumed to be
|
|
|
|
// unique for the duration of this call.
|
2019-04-17 14:57:13 +02:00
|
|
|
let _val = unsafe { *x }; //~ ERROR protect
|
2018-11-15 19:49:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut x = 0;
|
|
|
|
let xraw = &mut x as *mut _;
|
|
|
|
let xref = unsafe { &mut *xraw };
|
|
|
|
inner(xraw, xref);
|
|
|
|
}
|