-// Entry point for catching an exception, implemented using the `try` intrinsic
-// in the compiler.
-//
-// The interaction between the `payload` function and the compiler is pretty
-// hairy and tightly coupled, for more information see the compiler's
-// implementation of this.
-#[no_mangle]
-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 {
- let mut payload = imp::payload();
- if intrinsics::r#try(f, data, &mut payload as *mut _ as *mut _) == 0 {
- 0
- } else {
- let obj = mem::transmute::<_, raw::TraitObject>(imp::cleanup(payload));
- *data_ptr = obj.data as usize;
- *vtable_ptr = obj.vtable as usize;
- 1
- }
+#[rustc_std_internal_symbol]
+#[cfg_attr(not(bootstrap), allow(improper_ctypes_definitions))]
+pub unsafe extern "C" fn __rust_panic_cleanup(payload: *mut u8) -> *mut (dyn Any + Send + 'static) {
+ Box::into_raw(imp::cleanup(payload))