diff options
Diffstat (limited to 'src/bootstrap/builder.rs')
| -rw-r--r-- | src/bootstrap/builder.rs | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index fa2440e27d0..fad0a553802 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -769,6 +769,22 @@ impl<'a> Builder<'a> { let want_rustdoc = self.doc_tests != DocTests::No; + // We synthetically interpret a stage0 compiler used to build tools as a + // "raw" compiler in that it's the exact snapshot we download. Normally + // the stage0 build means it uses libraries build by the stage0 + // compiler, but for tools we just use the precompiled libraries that + // we've downloaded + let use_snapshot = mode == Mode::ToolBootstrap; + assert!(!use_snapshot || stage == 0); + + let maybe_sysroot = self.sysroot(compiler); + let sysroot = if use_snapshot { + self.rustc_snapshot_sysroot() + } else { + &maybe_sysroot + }; + let libdir = sysroot.join(libdir(&compiler.host)); + // Customize the compiler we're running. Specify the compiler to cargo // as our shim and then pass it some various options used to configure // how the actual compiler itself is called. @@ -784,8 +800,8 @@ impl<'a> Builder<'a> { "RUSTC_DEBUG_ASSERTIONS", self.config.rust_debug_assertions.to_string(), ) - .env("RUSTC_SYSROOT", self.sysroot(compiler)) - .env("RUSTC_LIBDIR", self.rustc_libdir(compiler)) + .env("RUSTC_SYSROOT", &sysroot) + .env("RUSTC_LIBDIR", &libdir) .env("RUSTC_RPATH", self.config.rust_rpath.to_string()) .env("RUSTDOC", self.out.join("bootstrap/debug/rustdoc")) .env( @@ -809,7 +825,7 @@ impl<'a> Builder<'a> { cargo.env("RUSTC_ERROR_FORMAT", error_format); } if cmd != "build" && cmd != "check" && want_rustdoc { - cargo.env("RUSTDOC_LIBDIR", self.sysroot_libdir(compiler, self.config.build)); + cargo.env("RUSTDOC_LIBDIR", &libdir); } if mode.is_tool() { |
