Skip to content

Commit 40c6720

Browse files
authored
Rollup merge of rust-lang#90625 - Milo123459:ref-unwind-safe, r=dtolnay
Add `UnwindSafe` to `Once` Fixes rust-lang#43469
2 parents 489296d + 91161ed commit 40c6720

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: library/std/src/sync/once.rs

+7
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ mod tests;
9090
use crate::cell::Cell;
9191
use crate::fmt;
9292
use crate::marker;
93+
use crate::panic::{RefUnwindSafe, UnwindSafe};
9394
use crate::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
9495
use crate::thread::{self, Thread};
9596

@@ -123,6 +124,12 @@ unsafe impl Sync for Once {}
123124
#[stable(feature = "rust1", since = "1.0.0")]
124125
unsafe impl Send for Once {}
125126

127+
#[stable(feature = "sync_once_unwind_safe", since = "1.59.0")]
128+
impl UnwindSafe for Once {}
129+
130+
#[stable(feature = "sync_once_unwind_safe", since = "1.59.0")]
131+
impl RefUnwindSafe for Once {}
132+
126133
/// State yielded to [`Once::call_once_force()`]’s closure parameter. The state
127134
/// can be used to query the poison status of the [`Once`].
128135
#[stable(feature = "once_poison", since = "1.51.0")]

0 commit comments

Comments
 (0)