]> git.lizzy.rs Git - rust.git/blob - src/tools/miri/tests/fail/stacked_borrows/pass_invalid_shr.rs
Rollup merge of #105459 - jyn514:proc-macro-default, r=Mark-Simulacrum
[rust.git] / src / tools / miri / tests / fail / stacked_borrows / pass_invalid_shr.rs
1 // Make sure that we cannot pass by argument a `&` that got already invalidated.
2 fn foo(_: &i32) {}
3
4 fn main() {
5     let x = &mut 42;
6     let xraw = x as *mut _;
7     let xref = unsafe { &*xraw };
8     unsafe { *xraw = 42 }; // unfreeze
9     foo(xref); //~ ERROR: /retag .* tag does not exist in the borrow stack/
10 }