about summary refs log tree commit diff
path: root/library/alloc/src
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2021-04-28 08:39:23 -0700
committerDavid Tolnay <dtolnay@gmail.com>2021-07-30 10:42:15 -0700
commit4e17994b2ca5da45f219ad09cad591fc7d31dd59 (patch)
tree33ff898f2fde44c54de0b517af80be02e438f15d /library/alloc/src
parent76e73b74a65b25d7c2fc25e006e42e3b4c41027c (diff)
downloadrust-4e17994b2ca5da45f219ad09cad591fc7d31dd59.tar.gz
rust-4e17994b2ca5da45f219ad09cad591fc7d31dd59.zip
Move UnwindSafe, RefUnwindSafe, AssertUnwindSafe to core
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> {}