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