Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
unix: Unsafe-wrap stack_overflow::cleanup
Editorialize on the wisdom of this as we do.
  • Loading branch information
workingjubilee committed Jul 18, 2024
commit fa628ceaff4e24fad699cc651cc6e7d521b642a9
7 changes: 6 additions & 1 deletion library/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