]> git.lizzy.rs Git - rust.git/blob - src/tools/miri/tests/fail/stacked_borrows/outdated_local.rs
Auto merge of #102169 - scottmcm:constify-some-conditions, r=thomcc
[rust.git] / src / tools / miri / tests / fail / stacked_borrows / outdated_local.rs
1 fn main() {
2     let mut x = 0;
3     let y: *const i32 = &x;
4     x = 1; // this invalidates y by reactivating the lowermost uniq borrow for this local
5
6     assert_eq!(unsafe { *y }, 1); //~ ERROR: /read access .* tag does not exist in the borrow stack/
7
8     assert_eq!(x, 1);
9 }