]> git.lizzy.rs Git - rust.git/commitdiff
Use Rust ABI for `__rust_start_panic` and `_{rdl,rg}_oom`
authorGary Guo <gary@garyguo.net>
Sat, 14 May 2022 01:46:46 +0000 (02:46 +0100)
committerGary Guo <gary@garyguo.net>
Sat, 14 May 2022 01:53:59 +0000 (02:53 +0100)
library/alloc/src/alloc.rs
library/panic_abort/src/lib.rs
library/panic_unwind/src/lib.rs
library/std/src/panicking.rs

index 39f8f1d5a0ec758812568ad6e4d9c4c974147dff..da61ff1e7512a734d53854fa116e0dd143f28642 100644 (file)
@@ -398,13 +398,13 @@ pub mod __alloc_error_handler {
 
     // if there is no `#[alloc_error_handler]`
     #[rustc_std_internal_symbol]
-    pub unsafe extern "C-unwind" fn __rdl_oom(size: usize, _align: usize) -> ! {
+    pub unsafe fn __rdl_oom(size: usize, _align: usize) -> ! {
         panic!("memory allocation of {size} bytes failed")
     }
 
     // if there is an `#[alloc_error_handler]`
     #[rustc_std_internal_symbol]
-    pub unsafe extern "C-unwind" fn __rg_oom(size: usize, align: usize) -> ! {
+    pub unsafe fn __rg_oom(size: usize, align: usize) -> ! {
         let layout = unsafe { Layout::from_size_align_unchecked(size, align) };
         extern "Rust" {
             #[lang = "oom"]
index 2bcb3182a7bf2eac0ec9b998ba0c78350bcfc1f1..0a1aa7bb3c833939e8477d172956bd7724beeb6b 100644 (file)
@@ -30,7 +30,7 @@
 
 // "Leak" the payload and shim to the relevant abort on the platform in question.
 #[rustc_std_internal_symbol]
-pub unsafe extern "C-unwind" fn __rust_start_panic(_payload: *mut &mut dyn BoxMeUp) -> u32 {
+pub unsafe fn __rust_start_panic(_payload: *mut &mut dyn BoxMeUp) -> u32 {
     // Android has the ability to attach a message as part of the abort.
     #[cfg(target_os = "android")]
     android::android_set_abort_message(_payload);
index 7f05c82ac284bdfc9c279c8ff0f4a221a3235464..4ae5f8ae4468d80e42e40f02ad55efcc4b39d3c2 100644 (file)
 // Entry point for raising an exception, just delegates to the platform-specific
 // implementation.
 #[rustc_std_internal_symbol]
-pub unsafe extern "C-unwind" fn __rust_start_panic(payload: *mut &mut dyn BoxMeUp) -> u32 {
+pub unsafe fn __rust_start_panic(payload: *mut &mut dyn BoxMeUp) -> u32 {
     let payload = Box::from_raw((*payload).take_box());
 
     imp::panic(payload)
index f1baf077580e672d03f4b924d7940d1dc0908740..9b045980d4543dfc33ebd3265aaace13afd55002 100644 (file)
@@ -47,7 +47,7 @@
 }
 
 #[allow(improper_ctypes)]
-extern "C-unwind" {
+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).