1 //@error-pattern: which is strongly protected
2 struct Newtype<'a>(&'a mut i32);
4 fn dealloc_while_running(_n: Newtype<'_>, dealloc: impl FnOnce()) {
8 // Make sure that we protect references inside structs.
10 let ptr = Box::into_raw(Box::new(0i32));
11 #[rustfmt::skip] // I like my newlines
13 dealloc_while_running(
15 || drop(Box::from_raw(ptr)),