X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=library%2Fstd%2Fsrc%2Fpanicking.rs;h=7de70091becf4f1188437962cdae2e40cd375907;hb=13f9a4c309eb35d0d2f48194edea044530177171;hp=0b9c9fb479f51dd1f09f37deea5d50beccab494d;hpb=f726dbe934d7dcf8ac72e5a8863703e64bb049ae;p=rust.git diff --git a/library/std/src/panicking.rs b/library/std/src/panicking.rs index 0b9c9fb479f..7de70091bec 100644 --- a/library/std/src/panicking.rs +++ b/library/std/src/panicking.rs @@ -43,11 +43,13 @@ #[allow(improper_ctypes)] extern "C" { fn __rust_panic_cleanup(payload: *mut u8) -> *mut (dyn Any + Send + 'static); +} +#[allow(improper_ctypes)] +extern "C-unwind" { /// `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). - #[unwind(allowed)] fn __rust_start_panic(payload: *mut &mut dyn BoxMeUp) -> u32; } @@ -448,6 +450,7 @@ pub fn panicking() -> bool { #[cfg_attr(not(feature = "panic_immediate_abort"), track_caller)] #[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))] #[cfg_attr(feature = "panic_immediate_abort", inline)] +#[cfg_attr(all(not(bootstrap), not(test)), lang = "begin_panic_fmt")] pub fn begin_panic_fmt(msg: &fmt::Arguments<'_>) -> ! { if cfg!(feature = "panic_immediate_abort") { intrinsics::abort() @@ -459,7 +462,6 @@ pub fn begin_panic_fmt(msg: &fmt::Arguments<'_>) -> ! { /// Entry point of panics from the libcore crate (`panic_impl` lang item). #[cfg_attr(not(test), panic_handler)] -#[unwind(allowed)] pub fn begin_panic_handler(info: &PanicInfo<'_>) -> ! { struct PanicPayload<'a> { inner: &'a fmt::Arguments<'a>,