about summary refs log tree commit diff
path: root/library/alloc/src/alloc.rs
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-03-05 11:32:03 +0100
committerRalf Jung <post@ralfj.de>2024-03-05 15:03:33 +0100
commitf391c0793b443d30ef8c4d4228550439d4dbfead (patch)
treea5da4c5407252088c561dc674881cffa5f833fae /library/alloc/src/alloc.rs
parent5a1e5449c8f4cb6b12b4f64238e3c058767ebf02 (diff)
downloadrust-f391c0793b443d30ef8c4d4228550439d4dbfead.tar.gz
rust-f391c0793b443d30ef8c4d4228550439d4dbfead.zip
only set noalias on Box with the global allocator
Diffstat (limited to 'library/alloc/src/alloc.rs')
-rw-r--r--library/alloc/src/alloc.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/library/alloc/src/alloc.rs b/library/alloc/src/alloc.rs
index 0b142939755..ed7b0618e9b 100644
--- a/library/alloc/src/alloc.rs
+++ b/library/alloc/src/alloc.rs
@@ -50,6 +50,8 @@ extern "Rust" {
 #[unstable(feature = "allocator_api", issue = "32838")]
 #[derive(Copy, Clone, Default, Debug)]
 #[cfg(not(test))]
+// the compiler needs to know when a Box uses the global allocator vs a custom one
+#[cfg_attr(not(bootstrap), lang = "global_alloc_ty")]
 pub struct Global;
 
 #[cfg(test)]