about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorbit-aloo <sshourya17@gmail.com>2025-07-28 19:23:04 +0530
committerbit-aloo <sshourya17@gmail.com>2025-07-28 19:23:04 +0530
commitdb42d5b36c804be21efd9c537a5a6771ec1c8201 (patch)
treeb612d63be7a5ea0aac5a4a6893d1a1dca9a20246 /src/bootstrap
parentf63f212a043dbc60fc28a4bf845662863d532fd7 (diff)
downloadrust-db42d5b36c804be21efd9c537a5a6771ec1c8201.tar.gz
rust-db42d5b36c804be21efd9c537a5a6771ec1c8201.zip
remove config wrappers of download_toolchain and maybe_download_fmt and during config parsing directly invoke cdownload methods
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/src/core/config/config.rs18
-rw-r--r--src/bootstrap/src/core/download.rs12
2 files changed, 13 insertions, 17 deletions
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<PathBuf> {
-        let dwn_ctx: DownloadContext<'_> = self.into();
-        maybe_download_rustfmt(dwn_ctx)
-    }
-
     pub(crate) fn ci_rust_std_contents(&self) -> Vec<String> {
         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,