diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2019-09-09 09:42:56 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2019-09-23 09:34:44 -0700 |
| commit | 2d6f3fede071514724e280a4394d915616b42634 (patch) | |
| tree | 8e5ea0d8d09dc7672e5a346999cbd532812aedd3 | |
| parent | 22699d31394489fd42ee53ba4fcf2543ca9a1ec6 (diff) | |
| download | rust-2d6f3fede071514724e280a4394d915616b42634.tar.gz rust-2d6f3fede071514724e280a4394d915616b42634.zip | |
Move handling of `codegen-units` to `builder.rs`
| -rw-r--r-- | src/bootstrap/bin/rustc.rs | 4 | ||||
| -rw-r--r-- | src/bootstrap/builder.rs | 14 |
2 files changed, 12 insertions, 6 deletions
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index 62ab6ef7ebe..84bb5390360 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -165,10 +165,6 @@ fn main() { cmd.arg("-C").arg(format!("debug-assertions={}", debug_assertions)); } - if let Ok(s) = env::var("RUSTC_CODEGEN_UNITS") { - cmd.arg("-C").arg(format!("codegen-units={}", s)); - } - if let Ok(map) = env::var("RUSTC_DEBUGINFO_MAP") { cmd.arg("--remap-path-prefix").arg(&map); } diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 62b77af13c1..776d163963a 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -774,7 +774,17 @@ impl<'a> Builder<'a> { cargo .env("CARGO_TARGET_DIR", out_dir) - .arg(cmd); + .arg(cmd) + .arg("-Zconfig-profile"); + + let profile_var = |name: &str| { + let profile = if self.config.rust_optimize { + "RELEASE" + } else { + "DEV" + }; + format!("CARGO_PROFILE_{}_{}", profile, name) + }; // See comment in librustc_llvm/build.rs for why this is necessary, largely llvm-config // needs to not accidentally link to libLLVM in stage0/lib. @@ -1190,7 +1200,7 @@ impl<'a> Builder<'a> { match (mode, self.config.rust_codegen_units_std, self.config.rust_codegen_units) { (Mode::Std, Some(n), _) | (_, _, Some(n)) => { - cargo.env("RUSTC_CODEGEN_UNITS", n.to_string()); + cargo.env(profile_var("CODEGEN_UNITS"), n.to_string()); } _ => { // Don't set anything |
