Skip to content

Commit f32459c

Browse files
committed
Auto merge of rust-lang#79172 - a1phyr:cold_abort, r=Mark-Simulacrum
Add #[cold] attribute to `std::process::abort` and `alloc::alloc::handle_alloc_error`
2 parents 32da90b + b4c91f9 commit f32459c

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

library/alloc/src/alloc.rs

+1
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ extern "Rust" {
360360
#[stable(feature = "global_alloc", since = "1.28.0")]
361361
#[cfg(not(test))]
362362
#[rustc_allocator_nounwind]
363+
#[cold]
363364
pub fn handle_alloc_error(layout: Layout) -> ! {
364365
unsafe {
365366
__rust_alloc_error_handler(layout.size(), layout.align());

library/std/src/process.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1779,6 +1779,7 @@ pub fn exit(code: i32) -> ! {
17791779
///
17801780
/// [panic hook]: crate::panic::set_hook
17811781
#[stable(feature = "process_abort", since = "1.17.0")]
1782+
#[cold]
17821783
pub fn abort() -> ! {
17831784
crate::sys::abort_internal();
17841785
}

0 commit comments

Comments
 (0)