Skip to content

Commit

Permalink
Mutex and RwLock need RefUnwindSafe too.
Browse files Browse the repository at this point in the history
  • Loading branch information
habnabit committed Jul 10, 2016
1 parent d40c593 commit c115405
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/libstd/panic.rs
Expand Up @@ -227,6 +227,12 @@ impl<T: ?Sized> !RefUnwindSafe for UnsafeCell<T> {}
#[stable(feature = "catch_unwind", since = "1.9.0")]
impl<T> RefUnwindSafe for AssertUnwindSafe<T> {}

// XXX: Obviously wrong, but what should it be?
#[stable(feature = "catch_unwind", since = "1.9.0")]
impl<T: ?Sized> RefUnwindSafe for Mutex<T> {}
#[stable(feature = "catch_unwind", since = "1.9.0")]
impl<T: ?Sized> RefUnwindSafe for RwLock<T> {}

#[stable(feature = "catch_unwind", since = "1.9.0")]
impl<T> Deref for AssertUnwindSafe<T> {
type Target = T;
Expand Down
2 changes: 2 additions & 0 deletions src/test/run-pass/panic-safe.rs
Expand Up @@ -36,6 +36,8 @@ fn main() {
assert::<Box<i32>>();
assert::<Mutex<i32>>();
assert::<RwLock<i32>>();
assert::<&Mutex<i32>>();
assert::<&RwLock<i32>>();
assert::<Rc<i32>>();
assert::<Arc<i32>>();

Expand Down

0 comments on commit c115405

Please sign in to comment.