about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2021-12-23 17:48:29 +0100
committerGitHub <noreply@github.com>2021-12-23 17:48:29 +0100
commit40c67206209b485b9e99f5e4e3a3bc9b8d255123 (patch)
tree596e93ccbc1c3205aea880b6b768fe1d12cca6f2
parent489296d82561f596c278e90edc10eb56168ab623 (diff)
parent91161ed110c87b6e2dba08269e45509e317fbc73 (diff)
downloadrust-40c67206209b485b9e99f5e4e3a3bc9b8d255123.tar.gz
rust-40c67206209b485b9e99f5e4e3a3bc9b8d255123.zip
Rollup merge of #90625 - Milo123459:ref-unwind-safe, r=dtolnay
Add `UnwindSafe` to `Once`

Fixes #43469
-rw-r--r--library/std/src/sync/once.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/library/std/src/sync/once.rs b/library/std/src/sync/once.rs
index 1710c005393..f76d0759561 100644
--- a/library/std/src/sync/once.rs
+++ b/library/std/src/sync/once.rs
@@ -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};
 
@@ -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")]