Skip to content

Commit

Permalink
Rollup merge of #90625 - Milo123459:ref-unwind-safe, r=dtolnay
Browse files Browse the repository at this point in the history
Add `UnwindSafe` to `Once`

Fixes #43469
  • Loading branch information
matthiaskrgr authored Dec 23, 2021
2 parents 489296d + 91161ed commit 40c6720
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions library/std/src/sync/once.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ mod tests;
use crate::cell::Cell;
use crate::fmt;
use crate::marker;
use crate::panic::{RefUnwindSafe, UnwindSafe};
use crate::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
use crate::thread::{self, Thread};

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

#[stable(feature = "sync_once_unwind_safe", since = "1.59.0")]
impl UnwindSafe for Once {}

#[stable(feature = "sync_once_unwind_safe", since = "1.59.0")]
impl RefUnwindSafe for Once {}

/// State yielded to [`Once::call_once_force()`]’s closure parameter. The state
/// can be used to query the poison status of the [`Once`].
#[stable(feature = "once_poison", since = "1.51.0")]
Expand Down

0 comments on commit 40c6720

Please sign in to comment.