about summary refs log tree commit diff
diff options
context:
space:
mode:
authorjyn <github@jyn.dev>2023-07-01 12:03:16 -0500
committerjyn <github@jyn.dev>2023-07-05 11:39:34 -0500
commitbaae59eea3230bdda6b536aaf8df15b9b96c599f (patch)
treee192639e5dad2596ed81b387fcb01da05b23bad6
parentf7287b9a2c3c161f038d3d83bc4e08cbec5d1841 (diff)
downloadrust-baae59eea3230bdda6b536aaf8df15b9b96c599f.tar.gz
rust-baae59eea3230bdda6b536aaf8df15b9b96c599f.zip
allow mixing `llvm.assertions` and `download-rustc`
by using `rustc-builds-alt` if download-rustc is set

this also changes the download code to use a separate build/cache/ directory and .rustc-stamp stamp file depending on whether assertions are enabled.
-rw-r--r--src/bootstrap/config.rs14
-rw-r--r--src/bootstrap/download.rs30
2 files changed, 22 insertions, 22 deletions
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index a16f762b2fb..af29fe0baae 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -39,16 +39,6 @@ macro_rules! check_ci_llvm {
     };
 }
 
-macro_rules! check_ci_rustc {
-    ($name:expr) => {
-        assert!(
-            $name.is_none(),
-            "setting {} is incompatible with download-ci-rustc.",
-            stringify!($name)
-        );
-    };
-}
-
 #[derive(Clone, Default)]
 pub enum DryRun {
     /// This isn't a dry run.
@@ -1518,10 +1508,6 @@ impl Config {
                 check_ci_llvm!(llvm.plugins);
             }
 
-            if config.download_rustc_commit.is_some() {
-                check_ci_rustc!(llvm.assertions);
-            }
-
             // NOTE: can never be hit when downloading from CI, since we call `check_ci_llvm!(thin_lto)` above.
             if config.llvm_thin_lto && llvm.link_shared.is_none() {
                 // If we're building with ThinLTO on, by default we want to link
diff --git a/src/bootstrap/download.rs b/src/bootstrap/download.rs
index fbb97a1ba6d..90578065ba2 100644
--- a/src/bootstrap/download.rs
+++ b/src/bootstrap/download.rs
@@ -423,7 +423,7 @@ impl Config {
         self.download_toolchain(
             &version,
             "ci-rustc",
-            commit,
+            &format!("{commit}-{}", self.llvm_assertions),
             &extra_components,
             Self::download_ci_component,
         );
@@ -499,8 +499,15 @@ impl Config {
 
     /// Download a single component of a CI-built toolchain (not necessarily a published nightly).
     // NOTE: intentionally takes an owned string to avoid downloading multiple times by accident
-    fn download_ci_component(&self, filename: String, prefix: &str, commit: &str) {
-        Self::download_component(self, DownloadSource::CI, filename, prefix, commit, "ci-rustc")
+    fn download_ci_component(&self, filename: String, prefix: &str, commit_with_assertions: &str) {
+        Self::download_component(
+            self,
+            DownloadSource::CI,
+            filename,
+            prefix,
+            commit_with_assertions,
+            "ci-rustc",
+        )
     }
 
     fn download_component(
@@ -520,11 +527,18 @@ impl Config {
         let bin_root = self.out.join(self.build.triple).join(destination);
         let tarball = cache_dir.join(&filename);
         let (base_url, url, should_verify) = match mode {
-            DownloadSource::CI => (
-                self.stage0_metadata.config.artifacts_server.clone(),
-                format!("{key}/{filename}"),
-                false,
-            ),
+            DownloadSource::CI => {
+                let dist_server = if self.llvm_assertions {
+                    self.stage0_metadata.config.artifacts_with_llvm_assertions_server.clone()
+                } else {
+                    self.stage0_metadata.config.artifacts_server.clone()
+                };
+                let url = format!(
+                    "{}/{filename}",
+                    key.strip_suffix(&format!("-{}", self.llvm_assertions)).unwrap()
+                );
+                (dist_server, url, false)
+            }
             DownloadSource::Dist => {
                 let dist_server = env::var("RUSTUP_DIST_SERVER")
                     .unwrap_or(self.stage0_metadata.config.dist_server.to_string());