about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-11-23 02:25:13 +0000
committerbors <bors@rust-lang.org>2020-11-23 02:25:13 +0000
commitf32459c7ba767e7f26e3c4c4bd6be326d83bcb78 (patch)
tree761b73c26c7cdba3c25d4be8acf496f91a8226ed
parent32da90b431919eedb3e281a91caea063ba4edb77 (diff)
parentb4c91f9a525096b52eaf3f0ffc5b147e39bca4a8 (diff)
downloadrust-f32459c7ba767e7f26e3c4c4bd6be326d83bcb78.tar.gz
rust-f32459c7ba767e7f26e3c4c4bd6be326d83bcb78.zip
Auto merge of #79172 - a1phyr:cold_abort, r=Mark-Simulacrum
Add #[cold] attribute to `std::process::abort` and `alloc::alloc::handle_alloc_error`
-rw-r--r--library/alloc/src/alloc.rs1
-rw-r--r--library/std/src/process.rs1
2 files changed, 2 insertions, 0 deletions
diff --git a/library/alloc/src/alloc.rs b/library/alloc/src/alloc.rs
index edbbe3603a7..b1bfc2abe44 100644
--- a/library/alloc/src/alloc.rs
+++ b/library/alloc/src/alloc.rs
@@ -360,6 +360,7 @@ extern "Rust" {
 #[stable(feature = "global_alloc", since = "1.28.0")]
 #[cfg(not(test))]
 #[rustc_allocator_nounwind]
+#[cold]
 pub fn handle_alloc_error(layout: Layout) -> ! {
     unsafe {
         __rust_alloc_error_handler(layout.size(), layout.align());
diff --git a/library/std/src/process.rs b/library/std/src/process.rs
index 2c7ed4614bc..2ffa7d2316a 100644
--- a/library/std/src/process.rs
+++ b/library/std/src/process.rs
@@ -1779,6 +1779,7 @@ pub fn exit(code: i32) -> ! {
 ///
 /// [panic hook]: crate::panic::set_hook
 #[stable(feature = "process_abort", since = "1.17.0")]
+#[cold]
 pub fn abort() -> ! {
     crate::sys::abort_internal();
 }