about summary refs log tree commit diff
path: root/src/libstd/lib.rs
diff options
context:
space:
mode:
authorAidan Hobson Sayers <aidanhs@cantab.net>2017-08-01 15:37:10 +0100
committerAidan Hobson Sayers <aidanhs@cantab.net>2017-08-07 21:44:02 +0100
commit458ba7aeb5c1ad3e18dd5c0fe261e1004dbb7a42 (patch)
tree9b1281a7403e95b76a85a519c6802987f1ea1088 /src/libstd/lib.rs
parente8f558543bf2c8e9c056443c144ca9c3ff98f0f3 (diff)
downloadrust-458ba7aeb5c1ad3e18dd5c0fe261e1004dbb7a42.tar.gz
rust-458ba7aeb5c1ad3e18dd5c0fe261e1004dbb7a42.zip
Make a disable-jemalloc build work
Fixes #43510
Diffstat (limited to 'src/libstd/lib.rs')
-rw-r--r--src/libstd/lib.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index bd9c9c74784..8850a8a5582 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -318,6 +318,16 @@
 
 #![default_lib_allocator]
 
+// Always use alloc_system during stage0 since we don't know if the alloc_*
+// crate the stage0 compiler will pick by default is available (most
+// obviously, if the user has disabled jemalloc in `./configure`).
+// `force_alloc_system` is *only* intended as a workaround for local rebuilds
+// with a rustc without jemalloc.
+#![cfg_attr(any(stage0, feature = "force_alloc_system"), feature(global_allocator))]
+#[cfg(any(stage0, feature = "force_alloc_system"))]
+#[global_allocator]
+static ALLOC: alloc_system::System = alloc_system::System;
+
 // Explicitly import the prelude. The compiler uses this same unstable attribute
 // to import the prelude implicitly when building crates that depend on std.
 #[prelude_import]