#![cfg(target_thread_local)]
#![unstable(feature = "thread_local_internals", issue = "none")]
-#![deny(unsafe_op_in_unsafe_fn)]
// Simplify dtor registration by using a list of destructors.
// The this solution works like the implementation of macOS and
DTORS.set(Box::into_raw(v));
}
- // SAFETY: `DTORS.get()` is not null.
- let list: &mut List = unsafe { &mut *DTORS.get() };
+ let list: &mut List = &mut *DTORS.get();
list.push((t, dtor));
}
pub unsafe fn run_dtors() {
let mut ptr = DTORS.replace(ptr::null_mut());
while !ptr.is_null() {
- // SAFETY: `ptr` is not null.
- let list = unsafe { Box::from_raw(ptr) };
+ let list = Box::from_raw(ptr);
for (ptr, dtor) in list.into_iter() {
dtor(ptr);
}