From db42d5b36c804be21efd9c537a5a6771ec1c8201 Mon Sep 17 00:00:00 2001 From: bit-aloo Date: Mon, 28 Jul 2025 19:23:04 +0530 Subject: remove config wrappers of download_toolchain and maybe_download_fmt and during config parsing directly invoke cdownload methods --- src/bootstrap/src/core/config/config.rs | 18 +++++++++++++----- src/bootstrap/src/core/download.rs | 12 ------------ 2 files changed, 13 insertions(+), 17 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index 6e04f115424..90001f9ae31 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -45,7 +45,9 @@ use crate::core::config::{ DebuginfoLevel, DryRun, GccCiMode, LlvmLibunwind, Merge, ReplaceOpt, RustcLto, SplitDebuginfo, StringOrBool, set, threads_from_config, }; -use crate::core::download::is_download_ci_available; +use crate::core::download::{ + DownloadContext, download_beta_toolchain, is_download_ci_available, maybe_download_rustfmt, +}; use crate::utils::channel; use crate::utils::exec::{ExecutionContext, command}; use crate::utils::helpers::{exe, get_host_target}; @@ -801,7 +803,8 @@ impl Config { } rustc } else { - config.download_beta_toolchain(); + let dwn_ctx = DownloadContext::from(&config); + download_beta_toolchain(dwn_ctx); config .out .join(config.host_target) @@ -827,7 +830,8 @@ impl Config { } cargo } else { - config.download_beta_toolchain(); + let dwn_ctx = DownloadContext::from(&config); + download_beta_toolchain(dwn_ctx); config.initial_sysroot.join("bin").join(exe("cargo", config.host_target)) }; @@ -994,8 +998,12 @@ impl Config { config.apply_dist_config(toml.dist); - config.initial_rustfmt = - if let Some(r) = rustfmt { Some(r) } else { config.maybe_download_rustfmt() }; + config.initial_rustfmt = if let Some(r) = rustfmt { + Some(r) + } else { + let dwn_ctx = DownloadContext::from(&config); + maybe_download_rustfmt(dwn_ctx) + }; if matches!(config.lld_mode, LldMode::SelfContained) && !config.lld_enabled diff --git a/src/bootstrap/src/core/download.rs b/src/bootstrap/src/core/download.rs index 2011e3067c4..7ec6c62a07d 100644 --- a/src/bootstrap/src/core/download.rs +++ b/src/bootstrap/src/core/download.rs @@ -128,13 +128,6 @@ impl Config { cargo_clippy } - /// NOTE: rustfmt is a completely different toolchain than the bootstrap compiler, so it can't - /// reuse target directories or artifacts - pub(crate) fn maybe_download_rustfmt(&self) -> Option { - let dwn_ctx: DownloadContext<'_> = self.into(); - maybe_download_rustfmt(dwn_ctx) - } - pub(crate) fn ci_rust_std_contents(&self) -> Vec { self.ci_component_contents(".rust-std-contents") } @@ -172,11 +165,6 @@ impl Config { ); } - pub(crate) fn download_beta_toolchain(&self) { - let dwn_ctx: DownloadContext<'_> = self.into(); - download_beta_toolchain(dwn_ctx); - } - fn download_toolchain( &self, version: &str, -- cgit 1.4.1-3-g733a5