]> git.lizzy.rs Git - rust.git/blob - src/tools/miri/tests/fail/stacked_borrows/deallocate_against_protector1.rs
Merge from rustc
[rust.git] / src / tools / miri / tests / fail / stacked_borrows / deallocate_against_protector1.rs
1 //@error-pattern: /deallocating while item \[Unique for .*\] is strongly protected/
2
3 fn inner(x: &mut i32, f: fn(&mut i32)) {
4     // `f` may mutate, but it may not deallocate!
5     f(x)
6 }
7
8 fn main() {
9     inner(Box::leak(Box::new(0)), |x| {
10         let raw = x as *mut _;
11         drop(unsafe { Box::from_raw(raw) });
12     });
13 }