]> git.lizzy.rs Git - rust.git/blobdiff - library/std/src/sys/hermit/thread_local_dtor.rs
Rollup merge of #82686 - CDirkx:unix-platform, r=m-ou-se
[rust.git] / library / std / src / sys / hermit / thread_local_dtor.rs
index 7998dd3cb4347f55a827c9ac3418e3526fcbd70f..9b683fce157488df8d26ee08184e278578e5c17b 100644 (file)
@@ -1,6 +1,5 @@
 #![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
@@ -20,8 +19,7 @@ pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern "C" fn(*mut u8)) {
         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));
 }
 
@@ -29,8 +27,7 @@ pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern "C" fn(*mut u8)) {
 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);
         }