about summary refs log tree commit diff
path: root/src/bootstrap/compile.rs
diff options
context:
space:
mode:
authorAidan Hobson Sayers <aidanhs@cantab.net>2017-01-15 22:33:58 +0000
committerAidan Hobson Sayers <aidanhs@cantab.net>2017-01-16 03:06:45 +0000
commit70d2372adaf48bb24f8b829417229149bd103e4a (patch)
tree771726183f4b644dda75df603c7f2c5c710144b7 /src/bootstrap/compile.rs
parentb0c52c587fe9ba287053359fff5ed886b7edb27c (diff)
Expose a feature to force use of alloc_system, teach rustbuild
This fixes jemalloc-less local rebuilds, where we tell cargo that
we're actually stage1
Diffstat (limited to 'src/bootstrap/compile.rs')
-rw-r--r--src/bootstrap/compile.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index 0eeb799672c..2464c978278 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -42,7 +42,16 @@ pub fn std(build: &Build, target: &str, compiler: &Compiler) {
     let out_dir = build.cargo_out(compiler, Mode::Libstd, target);
     build.clear_if_dirty(&out_dir, &build.compiler_path(compiler));
     let mut cargo = build.cargo(compiler, Mode::Libstd, target, "build");
-    cargo.arg("--features").arg(build.std_features())
+    let mut features = build.std_features();
+    // When doing a local rebuild we tell cargo that we're stage1 rather than
+    // stage0. This works fine if the local rust and being-built rust have the
+    // same view of what the default allocator is, but fails otherwise. Since
+    // we don't have a way to express an allocator preference yet, work
+    // around the issue in the case of a local rebuild with jemalloc disabled.
+    if compiler.stage == 0 && build.local_rebuild && !build.config.use_jemalloc {
+        features.push_str(" force_alloc_system");
+    }
+    cargo.arg("--features").arg(features)
          .arg("--manifest-path")
          .arg(build.src.join("src/rustc/std_shim/Cargo.toml"));