summaryrefslogtreecommitdiffstats
path: root/library/std/src/panicking.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:29 +0000
commit631cd5845e8de329d0e227aaa707d7ea228b8f8f (patch)
treea1b87c8f8cad01cf18f7c5f57a08f102771ed303 /library/std/src/panicking.rs
parentAdding debian version 1.69.0+dfsg1-1. (diff)
downloadrustc-631cd5845e8de329d0e227aaa707d7ea228b8f8f.tar.xz
rustc-631cd5845e8de329d0e227aaa707d7ea228b8f8f.zip
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/std/src/panicking.rs')
-rw-r--r--library/std/src/panicking.rs16
1 files changed, 6 insertions, 10 deletions
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: FnOnce() -> R>(f: F) -> Result<R, Box<dyn Any + Send>>
// 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<F: FnOnce() -> 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<dyn Any + Send>) -> ! {
/// 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}")
}