about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-04-05 13:50:17 +0000
committerbors <bors@rust-lang.org>2021-04-05 13:50:17 +0000
commit5a7a0ac51eefbdacc5b1763f8d49a787407afb34 (patch)
tree8cc9e203ddca741ce9899e6185e1aac39ec5bbfc /src/bootstrap
parent39eee173fbcc21462d255b364b87715cd33b62db (diff)
parentd856a26770787ce20f46e8bfe036d42fac313502 (diff)
Auto merge of #83890 - Dylan-DPC:rollup-9fqy3fe, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #83368 (Add `download-rustc = "if-unchanged"`)
 - #83705 (Give a better error when --theme is not a CSS file)
 - #83853 (Disallow the use of high byte registes as operands on x86_64)
 - #83877 (Remove unnecessary exceptions to the platform-specific code check)
 - #83878 (Fix racing file access in tidy)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/bootstrap.py8
-rw-r--r--src/bootstrap/config.rs5
2 files changed, 10 insertions, 3 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index 0b024d1333f..23af00d6293 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -644,8 +644,10 @@ class RustBuild(object):
     # If `download-rustc` is set, download the most recent commit with CI artifacts
     def maybe_download_ci_toolchain(self):
         # If `download-rustc` is not set, default to rebuilding.
-        if self.get_toml("download-rustc", section="rust") != "true":
+        download_rustc = self.get_toml("download-rustc", section="rust")
+        if download_rustc is None or download_rustc == "false":
             return None
+        assert download_rustc == "true" or download_rustc == "if-unchanged", download_rustc
 
         # Handle running from a directory other than the top level
         rev_parse = ["git", "rev-parse", "--show-toplevel"]
@@ -660,6 +662,8 @@ class RustBuild(object):
         # Warn if there were changes to the compiler since the ancestor commit.
         status = subprocess.call(["git", "diff-index", "--quiet", commit, "--", compiler])
         if status != 0:
+            if download_rustc == "if-unchanged":
+                return None
             print("warning: `download-rustc` is enabled, but there are changes to compiler/")
 
         if self.verbose:
@@ -1175,6 +1179,8 @@ def bootstrap(help_triggered):
     env["RUSTC_BOOTSTRAP"] = '1'
     if toml_path:
         env["BOOTSTRAP_CONFIG"] = toml_path
+    if build.rustc_commit is not None:
+        env["BOOTSTRAP_DOWNLOAD_RUSTC"] = '1'
     run(args, env=env, verbose=build.verbose)
 
 
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index 471f671fd27..04afed60a00 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -510,7 +510,8 @@ struct Rust {
     new_symbol_mangling: Option<bool>,
     profile_generate: Option<String>,
     profile_use: Option<String>,
-    download_rustc: Option<bool>,
+    // ignored; this is set from an env var set by bootstrap.py
+    download_rustc: Option<StringOrBool>,
 }
 
 /// TOML representation of how each build target is configured.
@@ -852,7 +853,7 @@ impl Config {
             config.rust_codegen_units_std = rust.codegen_units_std.map(threads_from_config);
             config.rust_profile_use = flags.rust_profile_use.or(rust.profile_use);
             config.rust_profile_generate = flags.rust_profile_generate.or(rust.profile_generate);
-            config.download_rustc = rust.download_rustc.unwrap_or(false);
+            config.download_rustc = env::var("BOOTSTRAP_DOWNLOAD_RUSTC").as_deref() == Ok("1");
         } else {
             config.rust_profile_use = flags.rust_profile_use;
             config.rust_profile_generate = flags.rust_profile_generate;