about summary refs log tree commit diff
path: root/library/alloc/src
diff options
context:
space:
mode:
Diffstat (limited to 'library/alloc/src')
-rw-r--r--library/alloc/src/lib.rs1
-rw-r--r--library/alloc/src/panic.rs11
2 files changed, 12 insertions, 0 deletions
diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs
index d2ececaa975..12a5868db74 100644
--- a/library/alloc/src/lib.rs
+++ b/library/alloc/src/lib.rs
@@ -177,6 +177,7 @@ mod boxed {
 pub mod borrow;
 pub mod collections;
 pub mod fmt;
+mod panic;
 pub mod prelude;
 pub mod raw_vec;
 pub mod rc;
diff --git a/library/alloc/src/panic.rs b/library/alloc/src/panic.rs
new file mode 100644
index 00000000000..666d4fa45aa
--- /dev/null
+++ b/library/alloc/src/panic.rs
@@ -0,0 +1,11 @@
+use crate::rc::Rc;
+use crate::sync::Arc;
+use core::panic::{RefUnwindSafe, UnwindSafe};
+
+// not covered via the Shared impl above b/c the inner contents use
+// Cell/AtomicUsize, but the usage here is unwind safe so we can lift the
+// impl up one level to Arc/Rc itself
+#[stable(feature = "catch_unwind", since = "1.9.0")]
+impl<T: RefUnwindSafe + ?Sized> UnwindSafe for Rc<T> {}
+#[stable(feature = "catch_unwind", since = "1.9.0")]
+impl<T: RefUnwindSafe + ?Sized> UnwindSafe for Arc<T> {}