Skip to content

Commit

Permalink
unix: Unsafe-wrap stack_overflow::cleanup
Browse files Browse the repository at this point in the history
Editorialize on the wisdom of this as we do.
  • Loading branch information
workingjubilee committed Jul 18, 2024
1 parent 33a32f2 commit 72c7444
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion std/src/sys/pal/unix/stack_overflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 72c7444

Please sign in to comment.