]> git.lizzy.rs Git - rust.git/commitdiff
Add #[cold] to `abort` and `handle_alloc_error`
authorBenoît du Garreau <benoit.dugarreau@platform.sh>
Wed, 18 Nov 2020 17:15:03 +0000 (18:15 +0100)
committerBenoît du Garreau <benoit.dugarreau@platform.sh>
Wed, 18 Nov 2020 17:15:03 +0000 (18:15 +0100)
library/alloc/src/alloc.rs
library/std/src/process.rs

index 3427c83a18f2a36afc440b2f6c036d901e39765c..7fcbffa7e43ea609ce29fff7fe4d14d5de9faf68 100644 (file)
@@ -360,6 +360,7 @@ pub(crate) unsafe fn box_free<T: ?Sized, A: AllocRef>(ptr: Unique<T>, alloc: A)
 #[stable(feature = "global_alloc", since = "1.28.0")]
 #[cfg(not(any(test, bootstrap)))]
 #[rustc_allocator_nounwind]
+#[cold]
 pub fn handle_alloc_error(layout: Layout) -> ! {
     unsafe {
         __rust_alloc_error_handler(layout.size(), layout.align());
index 2c7ed4614bce9e4701c3687481852d265f440eae..2ffa7d2316a04062c4c66cff64b240bce6068ae4 100644 (file)
@@ -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();
 }