diff options
| author | joboet <jonasboettiger@icloud.com> | 2025-03-29 12:16:49 +0100 |
|---|---|---|
| committer | joboet <jonasboettiger@icloud.com> | 2025-05-15 11:20:13 +0200 |
| commit | b7f2cd3a2b1606934018cc64bac52bb887ea892a (patch) | |
| tree | fc7da5ba2b2f5caa5ab7c8ba4a6f8f30ff623462 /library/std/src/rt.rs | |
| parent | 414482f6a0d4e7290f614300581a0b55442552a3 (diff) | |
| download | rust-b7f2cd3a2b1606934018cc64bac52bb887ea892a.tar.gz rust-b7f2cd3a2b1606934018cc64bac52bb887ea892a.zip | |
deduplicate abort implementations
Currently, the code for process aborts is duplicated across `panic_abort` and `std`. This PR uses `#[rustc_std_internal_symbol]` to make the `std` implementation available to `panic_abort` via the linker, thereby deduplicating the code.
Diffstat (limited to 'library/std/src/rt.rs')
| -rw-r--r-- | library/std/src/rt.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/library/std/src/rt.rs b/library/std/src/rt.rs index 9737b2f5bfe..b3f3b301e3d 100644 --- a/library/std/src/rt.rs +++ b/library/std/src/rt.rs @@ -26,6 +26,13 @@ use crate::sync::Once; use crate::thread::{self, main_thread}; use crate::{mem, panic, sys}; +// This function is needed by the panic runtime. +#[cfg(not(test))] +#[rustc_std_internal_symbol] +fn __rust_abort() { + crate::process::abort(); +} + // Prints to the "panic output", depending on the platform this may be: // - the standard error output // - some dedicated platform specific output @@ -47,7 +54,7 @@ macro_rules! rtabort { ($($t:tt)*) => { { rtprintpanic!("fatal runtime error: {}, aborting\n", format_args!($($t)*)); - crate::sys::abort_internal(); + crate::process::abort(); } } } |
