about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJubilee Young <workingjubilee@gmail.com>2024-07-16 21:07:44 -0700
committerJubilee Young <workingjubilee@gmail.com>2024-07-18 15:22:17 -0700
commitfa628ceaff4e24fad699cc651cc6e7d521b642a9 (patch)
tree07879c784dc97b175250ba1b96f68c33bf5c2e52
parent357ba1f8ec0326b9f285224fee8a97691485475f (diff)
downloadrust-fa628ceaff4e24fad699cc651cc6e7d521b642a9.tar.gz
rust-fa628ceaff4e24fad699cc651cc6e7d521b642a9.zip
unix: Unsafe-wrap stack_overflow::cleanup
Editorialize on the wisdom of this as we do.
-rw-r--r--library/std/src/sys/pal/unix/stack_overflow.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/library/std/src/sys/pal/unix/stack_overflow.rs b/library/std/src/sys/pal/unix/stack_overflow.rs
index 160e58e16a5..e016f3b3ca4 100644
--- a/library/std/src/sys/pal/unix/stack_overflow.rs
+++ b/library/std/src/sys/pal/unix/stack_overflow.rs
@@ -155,8 +155,13 @@ mod imp {
         }
     }
 
+    /// # Safety
+    /// Must be called only once
+    #[forbid(unsafe_op_in_unsafe_fn)]
     pub unsafe fn cleanup() {
-        drop_handler(MAIN_ALTSTACK.load(Ordering::Relaxed));
+        // FIXME: I probably cause more bugs than I'm worth!
+        // see https://github.com/rust-lang/rust/issues/111272
+        unsafe { drop_handler(MAIN_ALTSTACK.load(Ordering::Relaxed)) };
     }
 
     unsafe fn get_stack() -> libc::stack_t {