Skip to content

Commit baae59e

Browse files
committed
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.
1 parent f7287b9 commit baae59e

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

src/bootstrap/config.rs

-14
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,6 @@ macro_rules! check_ci_llvm {
3939
};
4040
}
4141

42-
macro_rules! check_ci_rustc {
43-
($name:expr) => {
44-
assert!(
45-
$name.is_none(),
46-
"setting {} is incompatible with download-ci-rustc.",
47-
stringify!($name)
48-
);
49-
};
50-
}
51-
5242
#[derive(Clone, Default)]
5343
pub enum DryRun {
5444
/// This isn't a dry run.
@@ -1518,10 +1508,6 @@ impl Config {
15181508
check_ci_llvm!(llvm.plugins);
15191509
}
15201510

1521-
if config.download_rustc_commit.is_some() {
1522-
check_ci_rustc!(llvm.assertions);
1523-
}
1524-
15251511
// NOTE: can never be hit when downloading from CI, since we call `check_ci_llvm!(thin_lto)` above.
15261512
if config.llvm_thin_lto && llvm.link_shared.is_none() {
15271513
// If we're building with ThinLTO on, by default we want to link

src/bootstrap/download.rs

+22-8
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ impl Config {
423423
self.download_toolchain(
424424
&version,
425425
"ci-rustc",
426-
commit,
426+
&format!("{commit}-{}", self.llvm_assertions),
427427
&extra_components,
428428
Self::download_ci_component,
429429
);
@@ -499,8 +499,15 @@ impl Config {
499499

500500
/// Download a single component of a CI-built toolchain (not necessarily a published nightly).
501501
// NOTE: intentionally takes an owned string to avoid downloading multiple times by accident
502-
fn download_ci_component(&self, filename: String, prefix: &str, commit: &str) {
503-
Self::download_component(self, DownloadSource::CI, filename, prefix, commit, "ci-rustc")
502+
fn download_ci_component(&self, filename: String, prefix: &str, commit_with_assertions: &str) {
503+
Self::download_component(
504+
self,
505+
DownloadSource::CI,
506+
filename,
507+
prefix,
508+
commit_with_assertions,
509+
"ci-rustc",
510+
)
504511
}
505512

506513
fn download_component(
@@ -520,11 +527,18 @@ impl Config {
520527
let bin_root = self.out.join(self.build.triple).join(destination);
521528
let tarball = cache_dir.join(&filename);
522529
let (base_url, url, should_verify) = match mode {
523-
DownloadSource::CI => (
524-
self.stage0_metadata.config.artifacts_server.clone(),
525-
format!("{key}/{filename}"),
526-
false,
527-
),
530+
DownloadSource::CI => {
531+
let dist_server = if self.llvm_assertions {
532+
self.stage0_metadata.config.artifacts_with_llvm_assertions_server.clone()
533+
} else {
534+
self.stage0_metadata.config.artifacts_server.clone()
535+
};
536+
let url = format!(
537+
"{}/{filename}",
538+
key.strip_suffix(&format!("-{}", self.llvm_assertions)).unwrap()
539+
);
540+
(dist_server, url, false)
541+
}
528542
DownloadSource::Dist => {
529543
let dist_server = env::var("RUSTUP_DIST_SERVER")
530544
.unwrap_or(self.stage0_metadata.config.dist_server.to_string());

0 commit comments

Comments
 (0)