2018-11-15 12:49:00 -06: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 07:57:13 -05:00
|
|
|
let _val = unsafe { *x }; //~ ERROR protect
|
2018-11-15 12:49:00 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut x = 0;
|
|
|
|
let xraw = &mut x as *mut _;
|
|
|
|
let xref = unsafe { &mut *xraw };
|
|
|
|
inner(xraw, xref);
|
|
|
|
}
|