Skip to content

Commit 769eb2c

Browse files
authored
Rollup merge of #121768 - ecton:condvar-unwindsafe, r=m-ou-se
Implement unwind safety for Condvar on all platforms Closes #118009 This commit adds unwind safety consistency to Condvar. Previously, only select platforms implemented unwind safety through auto traits. Known by this committer: On Linux, `Condvar` implemented `UnwindSafe` but on Mac and Windows, it did not. This change changes the implementation from auto to explicit. In #118009, it was suggested that the platform differences were a bug and that a simple PR could address this. In trying to determine the best information to put in the `#[stable]` attribute, it [was suggested](#121690 (comment)) I copy the stability information from the previous unwind safety implementations.
2 parents b55347a + 5512945 commit 769eb2c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

library/std/src/panic.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::any::Any;
66
use crate::collections;
77
use crate::panicking;
88
use crate::sync::atomic::{AtomicU8, Ordering};
9-
use crate::sync::{Mutex, RwLock};
9+
use crate::sync::{Condvar, Mutex, RwLock};
1010
use crate::thread::Result;
1111

1212
#[doc(hidden)]
@@ -67,11 +67,15 @@ pub fn panic_any<M: 'static + Any + Send>(msg: M) -> ! {
6767
impl<T: ?Sized> UnwindSafe for Mutex<T> {}
6868
#[stable(feature = "catch_unwind", since = "1.9.0")]
6969
impl<T: ?Sized> UnwindSafe for RwLock<T> {}
70+
#[stable(feature = "catch_unwind", since = "1.9.0")]
71+
impl UnwindSafe for Condvar {}
7072

7173
#[stable(feature = "unwind_safe_lock_refs", since = "1.12.0")]
7274
impl<T: ?Sized> RefUnwindSafe for Mutex<T> {}
7375
#[stable(feature = "unwind_safe_lock_refs", since = "1.12.0")]
7476
impl<T: ?Sized> RefUnwindSafe for RwLock<T> {}
77+
#[stable(feature = "unwind_safe_lock_refs", since = "1.12.0")]
78+
impl RefUnwindSafe for Condvar {}
7579

7680
// https://github.com/rust-lang/rust/issues/62301
7781
#[stable(feature = "hashbrown", since = "1.36.0")]

0 commit comments

Comments
 (0)