Skip to content

Commit c115405

Browse files
committed
Mutex and RwLock need RefUnwindSafe too.
1 parent d40c593 commit c115405

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/libstd/panic.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,12 @@ impl<T: ?Sized> !RefUnwindSafe for UnsafeCell<T> {}
227227
#[stable(feature = "catch_unwind", since = "1.9.0")]
228228
impl<T> RefUnwindSafe for AssertUnwindSafe<T> {}
229229

230+
// XXX: Obviously wrong, but what should it be?
231+
#[stable(feature = "catch_unwind", since = "1.9.0")]
232+
impl<T: ?Sized> RefUnwindSafe for Mutex<T> {}
233+
#[stable(feature = "catch_unwind", since = "1.9.0")]
234+
impl<T: ?Sized> RefUnwindSafe for RwLock<T> {}
235+
230236
#[stable(feature = "catch_unwind", since = "1.9.0")]
231237
impl<T> Deref for AssertUnwindSafe<T> {
232238
type Target = T;

src/test/run-pass/panic-safe.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ fn main() {
3636
assert::<Box<i32>>();
3737
assert::<Mutex<i32>>();
3838
assert::<RwLock<i32>>();
39+
assert::<&Mutex<i32>>();
40+
assert::<&RwLock<i32>>();
3941
assert::<Rc<i32>>();
4042
assert::<Arc<i32>>();
4143

0 commit comments

Comments
 (0)