unix: Unsafe-wrap stack_overflow::cleanup · model-checking/verify-rust-std@72c7444 (original) (raw)

Original file line number Diff line number Diff line change
@@ -155,8 +155,13 @@ mod imp {
155 155 }
156 156 }
157 157
158 +/// # Safety
159 + /// Must be called only once
160 + #[forbid(unsafe_op_in_unsafe_fn)]
158 161 pub unsafe fn cleanup() {
159 -drop_handler(MAIN_ALTSTACK.load(Ordering::Relaxed));
162 +// FIXME: I probably cause more bugs than I'm worth!
163 +// see https://github.com/rust-lang/rust/issues/111272
164 +unsafe { drop_handler(MAIN_ALTSTACK.load(Ordering::Relaxed)) };
160 165 }
161 166
162 167 unsafe fn get_stack() -> libc::stack_t {