about summary refs log tree commit diff
path: root/library/alloc/src/alloc.rs
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2022-11-05 12:35:40 +0100
committerRalf Jung <post@ralfj.de>2022-11-05 15:21:50 +0100
commit83239c2c1ebed372dd34016bdd75d02e4429589d (patch)
treef76015608b2a3fcdbdc5dc7f50049e089c6666d6 /library/alloc/src/alloc.rs
parent4492c029eff7b42e91e759576ab0c7ca88f873dc (diff)
parent452cf4f7109f58433ac38be7d3da527408571054 (diff)
downloadrust-83239c2c1ebed372dd34016bdd75d02e4429589d.tar.gz
rust-83239c2c1ebed372dd34016bdd75d02e4429589d.zip
Merge from rustc
Diffstat (limited to 'library/alloc/src/alloc.rs')
-rw-r--r--library/alloc/src/alloc.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/library/alloc/src/alloc.rs b/library/alloc/src/alloc.rs
index 8187517ccfb..8c6663569a5 100644
--- a/library/alloc/src/alloc.rs
+++ b/library/alloc/src/alloc.rs
@@ -402,19 +402,18 @@ pub use std::alloc::handle_alloc_error;
 #[allow(unused_attributes)]
 #[unstable(feature = "alloc_internals", issue = "none")]
 pub mod __alloc_error_handler {
-    use crate::alloc::Layout;
-
-    // called via generated `__rust_alloc_error_handler`
-
-    // if there is no `#[alloc_error_handler]`
+    // called via generated `__rust_alloc_error_handler` if there is no
+    // `#[alloc_error_handler]`.
     #[rustc_std_internal_symbol]
     pub unsafe fn __rdl_oom(size: usize, _align: usize) -> ! {
         panic!("memory allocation of {size} bytes failed")
     }
 
-    // if there is an `#[alloc_error_handler]`
+    #[cfg(bootstrap)]
     #[rustc_std_internal_symbol]
     pub unsafe fn __rg_oom(size: usize, align: usize) -> ! {
+        use crate::alloc::Layout;
+
         let layout = unsafe { Layout::from_size_align_unchecked(size, align) };
         extern "Rust" {
             #[lang = "oom"]