From e153d82c76a9749c91e6d50ff01636f0dbee0f14 Mon Sep 17 00:00:00 2001 From: jyn Date: Sat, 3 Jun 2023 13:09:01 -0500 Subject: [PATCH] Make `--dry-run` more useful when download-rustc is enabled Previously, it would always treat download-rustc as set to false, which made bootstrap issues with download-rustc hard to debug. --- src/bootstrap/config.rs | 4 ++-- src/bootstrap/download.rs | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 5f5f7ea25fb9..2320661bd030 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -1813,11 +1813,11 @@ impl Config { self.download_rustc_commit().is_some() } - pub(crate) fn download_rustc_commit(&self) -> Option<&'static str> { + pub(crate) fn download_rustc_commit(&self) -> Option<&str> { static DOWNLOAD_RUSTC: OnceCell> = OnceCell::new(); if self.dry_run() && DOWNLOAD_RUSTC.get().is_none() { // avoid trying to actually download the commit - return None; + return self.download_rustc_commit.as_deref(); } DOWNLOAD_RUSTC diff --git a/src/bootstrap/download.rs b/src/bootstrap/download.rs index cb40521dda76..fbb97a1ba6de 100644 --- a/src/bootstrap/download.rs +++ b/src/bootstrap/download.rs @@ -402,6 +402,10 @@ impl Config { fn ci_component_contents(&self, stamp_file: &str) -> Vec { assert!(self.download_rustc()); + if self.dry_run() { + return vec![]; + } + let ci_rustc_dir = self.out.join(&*self.build.triple).join("ci-rustc"); let stamp_file = ci_rustc_dir.join(stamp_file); let contents_file = t!(File::open(&stamp_file), stamp_file.display().to_string());