X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibpanic_abort%2Flib.rs;h=db7c250e21157810f35b357b6a2d072a924a042b;hb=88429fb5e250d61e60578e3ed5de4ac2d56567a8;hp=bc9dd2edaf21174b4588b66cf05e5951ef5c8278;hpb=f135e3312f5a99fd28184546f6111100828e1720;p=rust.git diff --git a/src/libpanic_abort/lib.rs b/src/libpanic_abort/lib.rs index bc9dd2edaf2..db7c250e211 100644 --- a/src/libpanic_abort/lib.rs +++ b/src/libpanic_abort/lib.rs @@ -5,12 +5,12 @@ #![no_std] #![unstable(feature = "panic_abort", issue = "32837")] -#![doc(html_root_url = "https://doc.rust-lang.org/nightly/", - issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")] +#![doc( + html_root_url = "https://doc.rust-lang.org/nightly/", + issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/" +)] #![panic_runtime] - #![allow(unused_features)] - #![feature(core_intrinsics)] #![feature(libc)] #![feature(nll)] @@ -21,11 +21,12 @@ // Rust's "try" function, but if we're aborting on panics we just call the // function as there's nothing else we need to do here. #[rustc_std_internal_symbol] -#[allow(improper_ctypes)] -pub unsafe extern fn __rust_maybe_catch_panic(f: fn(*mut u8), - data: *mut u8, - _data_ptr: *mut usize, - _vtable_ptr: *mut usize) -> u32 { +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 { f(data); 0 } @@ -41,7 +42,7 @@ // will kill us with an illegal instruction, which will do a good enough job for // now hopefully. #[rustc_std_internal_symbol] -pub unsafe extern fn __rust_start_panic(_payload: usize) -> u32 { +pub unsafe extern "C" fn __rust_start_panic(_payload: usize) -> u32 { abort(); #[cfg(any(unix, target_os = "cloudabi"))] @@ -49,17 +50,17 @@ unsafe fn abort() -> ! { libc::abort(); } - #[cfg(any(windows, - all(target_arch = "wasm32", not(target_os = "emscripten"))))] + #[cfg(any(windows, all(target_arch = "wasm32", not(target_os = "emscripten"))))] unsafe fn abort() -> ! { core::intrinsics::abort(); } - #[cfg(any(target_os = "hermit", - all(target_vendor="fortanix", target_env="sgx")))] + #[cfg(any(target_os = "hermit", all(target_vendor = "fortanix", target_env = "sgx")))] unsafe fn abort() -> ! { // call std::sys::abort_internal - extern "C" { pub fn __rust_abort() -> !; } + extern "C" { + pub fn __rust_abort() -> !; + } __rust_abort(); } } @@ -93,28 +94,21 @@ unsafe fn abort() -> ! { pub mod personalities { #[no_mangle] #[cfg(not(any( - all( - target_arch = "wasm32", - not(target_os = "emscripten"), - ), - all( - target_os = "windows", - target_env = "gnu", - target_arch = "x86_64", - ), + all(target_arch = "wasm32", not(target_os = "emscripten"),), + all(target_os = "windows", target_env = "gnu", target_arch = "x86_64",), )))] - pub extern fn rust_eh_personality() {} + pub extern "C" fn rust_eh_personality() {} // On x86_64-pc-windows-gnu we use our own personality function that needs // to return `ExceptionContinueSearch` as we're passing on all our frames. #[no_mangle] - #[cfg(all(target_os = "windows", - target_env = "gnu", - target_arch = "x86_64"))] - pub extern fn rust_eh_personality(_record: usize, - _frame: usize, - _context: usize, - _dispatcher: usize) -> u32 { + #[cfg(all(target_os = "windows", target_env = "gnu", target_arch = "x86_64"))] + pub extern "C" fn rust_eh_personality( + _record: usize, + _frame: usize, + _context: usize, + _dispatcher: usize, + ) -> u32 { 1 // `ExceptionContinueSearch` } @@ -125,14 +119,14 @@ pub mod personalities { // body is empty. #[no_mangle] #[cfg(all(target_os = "windows", target_env = "gnu"))] - pub extern fn rust_eh_unwind_resume() {} + pub extern "C" fn rust_eh_unwind_resume() {} // These two are called by our startup objects on i686-pc-windows-gnu, but // they don't need to do anything so the bodies are nops. #[no_mangle] #[cfg(all(target_os = "windows", target_env = "gnu", target_arch = "x86"))] - pub extern fn rust_eh_register_frames() {} + pub extern "C" fn rust_eh_register_frames() {} #[no_mangle] #[cfg(all(target_os = "windows", target_env = "gnu", target_arch = "x86"))] - pub extern fn rust_eh_unregister_frames() {} + pub extern "C" fn rust_eh_unregister_frames() {} }