]> git.lizzy.rs Git - rust.git/commitdiff
Add UnwindSafe to Once
authorMilo <50248166+Milo123459@users.noreply.github.com>
Fri, 5 Nov 2021 18:27:54 +0000 (18:27 +0000)
committerMilo <50248166+Milo123459@users.noreply.github.com>
Fri, 5 Nov 2021 18:27:54 +0000 (18:27 +0000)
library/std/src/sync/once.rs

index 1710c0053934a76bc26e8b8fe929c5fb94db353e..47921283b21853799481ba9d26648bd30a817e23 100644 (file)
@@ -90,6 +90,7 @@
 use crate::cell::Cell;
 use crate::fmt;
 use crate::marker;
+use crate::panic::UnwindSafe;
 use crate::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
 use crate::thread::{self, Thread};
 
@@ -123,6 +124,9 @@ unsafe impl Sync for Once {}
 #[stable(feature = "rust1", since = "1.0.0")]
 unsafe impl Send for Once {}
 
+#[stable(feature = "sync_once_ref_unwind_safe", since = "1.59.0")]
+impl UnwindSafe 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")]