X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fbootstrap%2Fbuilder.rs;h=00c8e72a8f6851c82c68a4f0cd2925d8fd3ed584;hb=3850d96379126087240b640470632362a5d32234;hp=a2dca66697d6d641b971ae43700ebdf70e03ee1b;hpb=6f38a15c7b5a57abf024e7e38cb0239e39037e9f;p=rust.git diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index a2dca66697d..00c8e72a8f6 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -343,6 +343,7 @@ macro_rules! describe { tool::Rustdoc, tool::Clippy, native::Llvm, + native::Sanitizers, tool::Rustfmt, tool::Miri, native::Lld @@ -726,7 +727,7 @@ pub fn cargo( self.clear_if_dirty(&my_out, &rustdoc); } - cargo.env("CARGO_TARGET_DIR", out_dir).arg(cmd).arg("-Zconfig-profile"); + cargo.env("CARGO_TARGET_DIR", &out_dir).arg(cmd).arg("-Zconfig-profile"); let profile_var = |name: &str| { let profile = if self.config.rust_optimize { "RELEASE" } else { "DEV" }; @@ -865,6 +866,18 @@ pub fn cargo( let sysroot = if use_snapshot { self.rustc_snapshot_sysroot() } else { &maybe_sysroot }; let libdir = self.rustc_libdir(compiler); + // Clear the output directory if the real rustc we're using has changed; + // Cargo cannot detect this as it thinks rustc is bootstrap/debug/rustc. + // + // Avoid doing this during dry run as that usually means the relevant + // compiler is not yet linked/copied properly. + // + // Only clear out the directory if we're compiling std; otherwise, we + // should let Cargo take care of things for us (via depdep info) + if !self.config.dry_run && mode == Mode::ToolStd && cmd == "build" { + self.clear_if_dirty(&out_dir, &self.rustc(compiler)); + } + // 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. @@ -1183,6 +1196,21 @@ pub fn cargo( rustflags.arg("-Cprefer-dynamic"); } + // When building incrementally we default to a lower ThinLTO import limit + // (unless explicitly specified otherwise). This will produce a somewhat + // slower code but give way better compile times. + { + let limit = match self.config.rust_thin_lto_import_instr_limit { + Some(limit) => Some(limit), + None if self.config.incremental => Some(10), + _ => None, + }; + + if let Some(limit) = limit { + rustflags.arg(&format!("-Cllvm-args=-import-instr-limit={}", limit)); + } + } + Cargo { command: cargo, rustflags } }