]> git.lizzy.rs Git - rust.git/blob - src/tools/miri/tests/fail/stacked_borrows/invalidate_against_protector1.rs
Rollup merge of #102112 - cuviper:powerpc64-full-relro, r=eholk
[rust.git] / src / tools / miri / tests / fail / stacked_borrows / invalidate_against_protector1.rs
1 fn inner(x: *mut i32, _y: &mut i32) {
2     // If `x` and `y` alias, retagging is fine with this... but we really
3     // shouldn't be allowed to use `x` at all because `y` was assumed to be
4     // unique for the duration of this call.
5     let _val = unsafe { *x }; //~ ERROR: protect
6 }
7
8 fn main() {
9     let mut x = 0;
10     let xraw = &mut x as *mut _;
11     let xref = unsafe { &mut *xraw };
12     inner(xraw, xref);
13 }