From 55129453c6cfed8884e58be1f7435d4e35a77f0d Mon Sep 17 00:00:00 2001 From: Jonathan Johnson Date: Wed, 28 Feb 2024 14:56:36 -0800 Subject: [PATCH] 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. --- library/std/src/panic.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/std/src/panic.rs b/library/std/src/panic.rs index 3728d5b64b865..3d576af681e03 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(msg: M) -> ! { impl UnwindSafe for Mutex {} #[stable(feature = "catch_unwind", since = "1.9.0")] impl UnwindSafe for RwLock {} +#[stable(feature = "catch_unwind", since = "1.9.0")] +impl UnwindSafe for Condvar {} #[stable(feature = "unwind_safe_lock_refs", since = "1.12.0")] impl RefUnwindSafe for Mutex {} #[stable(feature = "unwind_safe_lock_refs", since = "1.12.0")] impl RefUnwindSafe for RwLock {} +#[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")]