1 // error-pattern: deallocating while item is protected 2 inner(x: &mut i32, f: fn(&mut i32))3fn inner(x: &mut i32, f: fn(&mut i32)) { 4 // `f` may mutate, but it may not deallocate! 5 f(x) 6 } 7 main()8fn main() { 9 inner(Box::leak(Box::new(0)), |x| { 10 let raw = x as *mut _; 11 drop(unsafe { Box::from_raw(raw) }); 12 }); 13 } 14