1 //@error-pattern: /deallocating while item \[SharedReadWrite for .*\] is strongly protected/
2 use std::marker::PhantomPinned;
4 pub struct NotUnpin(i32, PhantomPinned);
6 fn inner(x: &mut NotUnpin, f: fn(&mut NotUnpin)) {
7 // `f` may mutate, but it may not deallocate!
12 inner(Box::leak(Box::new(NotUnpin(0, PhantomPinned))), |x| {
13 let raw = x as *mut _;
14 drop(unsafe { Box::from_raw(raw) });