From baae59eea3230bdda6b536aaf8df15b9b96c599f Mon Sep 17 00:00:00 2001 From: jyn Date: Sat, 1 Jul 2023 12:03:16 -0500 Subject: [PATCH] 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. --- src/bootstrap/config.rs | 14 -------------- src/bootstrap/download.rs | 30 ++++++++++++++++++++++-------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index a16f762b2fb0..af29fe0baae2 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 fbb97a1ba6de..90578065ba2d 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());