about summary refs log tree commit diff
path: root/library/std/src/panic.rs
diff options
context:
space:
mode:
authorJonathan Johnson <jon@khonsulabs.com>2024-02-28 14:56:36 -0800
committerJonathan Johnson <jon@khonsulabs.com>2024-02-28 14:56:36 -0800
commit55129453c6cfed8884e58be1f7435d4e35a77f0d (patch)
tree4f38d5d22ff7147b428f8829888c99cc87362810 /library/std/src/panic.rs
parent9afdb8d1d55f7ee80259009c39530d163d24dc65 (diff)
downloadrust-55129453c6cfed8884e58be1f7435d4e35a77f0d.tar.gz
rust-55129453c6cfed8884e58be1f7435d4e35a77f0d.zip
Implement unwind safety for Condvar
Closes #118009

This commit adds unwind safety to Condvar. Previously, only select
platforms implemented unwind safety through auto traits. Known by this
committer: Linux was unwind safe, but Mac and Windows are not before
this change.
Diffstat (limited to 'library/std/src/panic.rs')
-rw-r--r--library/std/src/panic.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/library/std/src/panic.rs b/library/std/src/panic.rs
index 3728d5b64b8..3d576af681e 100644
--- a/library/std/src/panic.rs
+++ b/library/std/src/panic.rs
@@ -6,7 +6,7 @@ use crate::any::Any;
 use crate::collections;
 use crate::panicking;
 use crate::sync::atomic::{AtomicU8, Ordering};
-use crate::sync::{Mutex, RwLock};
+use crate::sync::{Condvar, Mutex, RwLock};
 use crate::thread::Result;
 
 #[doc(hidden)]
@@ -67,11 +67,15 @@ pub fn panic_any<M: 'static + Any + Send>(msg: M) -> ! {
 impl<T: ?Sized> UnwindSafe for Mutex<T> {}
 #[stable(feature = "catch_unwind", since = "1.9.0")]
 impl<T: ?Sized> UnwindSafe for RwLock<T> {}
+#[stable(feature = "catch_unwind", since = "1.9.0")]
+impl UnwindSafe for Condvar {}
 
 #[stable(feature = "unwind_safe_lock_refs", since = "1.12.0")]
 impl<T: ?Sized> RefUnwindSafe for Mutex<T> {}
 #[stable(feature = "unwind_safe_lock_refs", since = "1.12.0")]
 impl<T: ?Sized> RefUnwindSafe for RwLock<T> {}
+#[stable(feature = "unwind_safe_lock_refs", since = "1.12.0")]
+impl RefUnwindSafe for Condvar {}
 
 // https://github.com/rust-lang/rust/issues/62301
 #[stable(feature = "hashbrown", since = "1.36.0")]