From 631cd5845e8de329d0e227aaa707d7ea228b8f8f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:20:29 +0200 Subject: Merging upstream version 1.70.0+dfsg1. Signed-off-by: Daniel Baumann --- library/std/src/panicking.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'library/std/src/panicking.rs') diff --git a/library/std/src/panicking.rs b/library/std/src/panicking.rs index e59f32af7..a46a29cba 100644 --- a/library/std/src/panicking.rs +++ b/library/std/src/panicking.rs @@ -46,12 +46,10 @@ extern "C" { fn __rust_panic_cleanup(payload: *mut u8) -> *mut (dyn Any + Send + 'static); } -#[allow(improper_ctypes)] extern "Rust" { - /// `payload` is passed through another layer of raw pointers as `&mut dyn Trait` is not - /// FFI-safe. `BoxMeUp` lazily performs allocation only when needed (this avoids allocations - /// when using the "abort" panic runtime). - fn __rust_start_panic(payload: *mut &mut dyn BoxMeUp) -> u32; + /// `BoxMeUp` lazily performs allocation only when needed (this avoids + /// allocations when using the "abort" panic runtime). + fn __rust_start_panic(payload: &mut dyn BoxMeUp) -> u32; } /// This function is called by the panic runtime if FFI code catches a Rust @@ -500,6 +498,7 @@ pub unsafe fn r#try R>(f: F) -> Result> // This function cannot be marked as `unsafe` because `intrinsics::r#try` // expects normal function pointers. #[inline] + #[rustc_nounwind] // `intrinsic::r#try` requires catch fn to be nounwind fn do_catch R, R>(data: *mut u8, payload: *mut u8) { // SAFETY: this is the responsibility of the caller, see above. // @@ -738,10 +737,7 @@ pub fn rust_panic_without_hook(payload: Box) -> ! { /// yer breakpoints. #[inline(never)] #[cfg_attr(not(test), rustc_std_internal_symbol)] -fn rust_panic(mut msg: &mut dyn BoxMeUp) -> ! { - let code = unsafe { - let obj = &mut msg as *mut &mut dyn BoxMeUp; - __rust_start_panic(obj) - }; +fn rust_panic(msg: &mut dyn BoxMeUp) -> ! { + let code = unsafe { __rust_start_panic(msg) }; rtabort!("failed to initiate panic, error {code}") } -- cgit v1.2.3