summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-08-10 22:32:51 +0000
committerbors <bors@rust-lang.org>2017-08-10 22:32:51 +0000
commit6c5212ffa06d329bc9ca699e8687b6e45949b88a (patch)
tree9a52e55cd9b7da7d78fb06b5eb74254b65aa488d /src/libstd
parent13d94d5fa8129a34f5c77a1bcd76983f5aed2434 (diff)
parent56a07539c0efd865b33dd07cd14b97d8ba23c584 (diff)
downloadrust-6c5212ffa06d329bc9ca699e8687b6e45949b88a.tar.gz
rust-6c5212ffa06d329bc9ca699e8687b6e45949b88a.zip
Auto merge of #43589 - aidanhs:aphs-fix-system-malloc, r=alexcrichton
Make a disable-jemalloc build work

Fixes #43510. I've tested this up to building a stage1 compiler.

r? @alexcrichton

cc @cuviper @vorner

@cuviper your fix was almost correct, you just had a stray `!` in there which caused the second error you saw.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/lib.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index bd9c9c74784..f7748aa3f04 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -318,6 +318,22 @@
 
 #![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 enabled (e.g.
+// 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.
+// The not(stage0+msvc) gates will only last until the next stage0 bump
+#![cfg_attr(all(
+        not(all(stage0, target_env = "msvc")),
+        any(stage0, feature = "force_alloc_system")),
+    feature(global_allocator))]
+#[cfg(all(
+    not(all(stage0, target_env = "msvc")),
+    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]