From c11540587f45826c76f33b7fbbb9a919a5af8ebd Mon Sep 17 00:00:00 2001 From: Aaron Gallagher <_@habnab.it> Date: Fri, 8 Jul 2016 22:48:04 -0700 Subject: [PATCH 1/2] Mutex and RwLock need RefUnwindSafe too. --- src/libstd/panic.rs | 6 ++++++ src/test/run-pass/panic-safe.rs | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/libstd/panic.rs b/src/libstd/panic.rs index d8cadf09cb2..d5699fca85d 100644 --- a/src/libstd/panic.rs +++ b/src/libstd/panic.rs @@ -227,6 +227,12 @@ impl !RefUnwindSafe for UnsafeCell {} #[stable(feature = "catch_unwind", since = "1.9.0")] impl RefUnwindSafe for AssertUnwindSafe {} +// XXX: Obviously wrong, but what should it be? +#[stable(feature = "catch_unwind", since = "1.9.0")] +impl RefUnwindSafe for Mutex {} +#[stable(feature = "catch_unwind", since = "1.9.0")] +impl RefUnwindSafe for RwLock {} + #[stable(feature = "catch_unwind", since = "1.9.0")] impl Deref for AssertUnwindSafe { type Target = T; diff --git a/src/test/run-pass/panic-safe.rs b/src/test/run-pass/panic-safe.rs index b918f79f2d5..493a00ac5d0 100644 --- a/src/test/run-pass/panic-safe.rs +++ b/src/test/run-pass/panic-safe.rs @@ -36,6 +36,8 @@ fn main() { assert::>(); assert::>(); assert::>(); + assert::<&Mutex>(); + assert::<&RwLock>(); assert::>(); assert::>(); From fbec232df1de37fce9badfe56c4a1d7c0050f3d5 Mon Sep 17 00:00:00 2001 From: Aaron Gallagher <_@habnab.it> Date: Mon, 11 Jul 2016 07:34:20 -0700 Subject: [PATCH 2/2] Set unwind_safe_lock_refs stability to 1.12.0. This is the first (and presumably only) use of this feature. --- src/libstd/panic.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/libstd/panic.rs b/src/libstd/panic.rs index d5699fca85d..ba18d15f5c4 100644 --- a/src/libstd/panic.rs +++ b/src/libstd/panic.rs @@ -227,10 +227,9 @@ impl !RefUnwindSafe for UnsafeCell {} #[stable(feature = "catch_unwind", since = "1.9.0")] impl RefUnwindSafe for AssertUnwindSafe {} -// XXX: Obviously wrong, but what should it be? -#[stable(feature = "catch_unwind", since = "1.9.0")] +#[stable(feature = "unwind_safe_lock_refs", since = "1.12.0")] impl RefUnwindSafe for Mutex {} -#[stable(feature = "catch_unwind", since = "1.9.0")] +#[stable(feature = "unwind_safe_lock_refs", since = "1.12.0")] impl RefUnwindSafe for RwLock {} #[stable(feature = "catch_unwind", since = "1.9.0")]