]> git.lizzy.rs Git - rust.git/blob - src/tools/miri/tests/fail/stacked_borrows/fnentry_invalidation.rs
Rollup merge of #103204 - jyn514:autolabels, r=Mark-Simulacrum
[rust.git] / src / tools / miri / tests / fail / stacked_borrows / fnentry_invalidation.rs
1 // Test that spans displayed in diagnostics identify the function call, not the function
2 // definition, as the location of invalidation due to FnEntry retag. Technically the FnEntry retag
3 // occurs inside the function, but what the user wants to know is which call produced the
4 // invalidation.
5 fn main() {
6     let mut x = 0i32;
7     let z = &mut x as *mut i32;
8     x.do_bad();
9     unsafe {
10         let _oof = *z; //~ ERROR: /read access .* tag does not exist in the borrow stack/
11     }
12 }
13
14 trait Bad {
15     fn do_bad(&mut self) {
16         // who knows
17     }
18 }
19
20 impl Bad for i32 {}