about summary refs log tree commit diff
path: root/src/libpanic_abort
diff options
context:
space:
mode:
authorMark Rousskov <mark.simulacrum@gmail.com>2019-12-26 10:02:21 -0500
committerAmanieu d'Antras <amanieu@gmail.com>2020-03-02 11:43:06 +0000
commitd45ce5aed63fb58385705016dfaff1832a58d7c8 (patch)
tree35a9bea734e796c0690399f6ebfc5049994b02f3 /src/libpanic_abort
parent6b2983af1a85d857ae3a9345ac93ba0564ab7a73 (diff)
downloadrust-d45ce5aed63fb58385705016dfaff1832a58d7c8.tar.gz
rust-d45ce5aed63fb58385705016dfaff1832a58d7c8.zip
Inline catching panics into std::catch_unwind
This allows LLVM to inline the happy path, such that catching unwinding is
zero-cost when no panic occurs. This also allows us to match the code generated
by C++ try/catch.
Diffstat (limited to 'src/libpanic_abort')
-rw-r--r--src/libpanic_abort/lib.rs13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/libpanic_abort/lib.rs b/src/libpanic_abort/lib.rs
index db7c250e211..ebc57860b9d 100644
--- a/src/libpanic_abort/lib.rs
+++ b/src/libpanic_abort/lib.rs
@@ -17,18 +17,11 @@
 #![feature(panic_runtime)]
 #![feature(staged_api)]
 #![feature(rustc_attrs)]
+#![feature(raw)]
 
-// Rust's "try" function, but if we're aborting on panics we just call the
-// function as there's nothing else we need to do here.
 #[rustc_std_internal_symbol]
-pub unsafe extern "C" fn __rust_maybe_catch_panic(
-    f: fn(*mut u8),
-    data: *mut u8,
-    _data_ptr: *mut usize,
-    _vtable_ptr: *mut usize,
-) -> u32 {
-    f(data);
-    0
+pub unsafe extern "C" fn __rust_cleanup(_: *mut u8) -> core::raw::TraitObject {
+    unreachable!()
 }
 
 // "Leak" the payload and shim to the relevant abort on the platform in