Skip to content

Commit c496f05

Browse files
unix: Unsafe-wrap stack_overflow::cleanup
1 parent 9ad696a commit c496f05

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,11 @@ mod imp {
157157
mem::forget(handler);
158158
}
159159

160+
/// # Safety
161+
/// Must be called only once
162+
#[forbid(unsafe_op_in_unsafe_fn)]
160163
pub unsafe fn cleanup() {
161-
drop_handler(MAIN_ALTSTACK.load(Ordering::Relaxed));
164+
unsafe { drop_handler(MAIN_ALTSTACK.load(Ordering::Relaxed)) };
162165
}
163166

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

0 commit comments

Comments
 (0)