Skip to content

Commit 72c7444

Browse files
unix: Unsafe-wrap stack_overflow::cleanup
Editorialize on the wisdom of this as we do.
1 parent 33a32f2 commit 72c7444

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

std/src/sys/pal/unix/stack_overflow.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,13 @@ mod imp {
155155
}
156156
}
157157

158+
/// # Safety
159+
/// Must be called only once
160+
#[forbid(unsafe_op_in_unsafe_fn)]
158161
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)) };
160165
}
161166

162167
unsafe fn get_stack() -> libc::stack_t {

0 commit comments

Comments
 (0)