Skip to content

Commit db42d5b

Browse files
committed
remove config wrappers of download_toolchain and maybe_download_fmt and during config parsing directly invoke cdownload methods
1 parent f63f212 commit db42d5b

File tree

2 files changed

+13
-17
lines changed

2 files changed

+13
-17
lines changed

src/bootstrap/src/core/config/config.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ use crate::core::config::{
4545
DebuginfoLevel, DryRun, GccCiMode, LlvmLibunwind, Merge, ReplaceOpt, RustcLto, SplitDebuginfo,
4646
StringOrBool, set, threads_from_config,
4747
};
48-
use crate::core::download::is_download_ci_available;
48+
use crate::core::download::{
49+
DownloadContext, download_beta_toolchain, is_download_ci_available, maybe_download_rustfmt,
50+
};
4951
use crate::utils::channel;
5052
use crate::utils::exec::{ExecutionContext, command};
5153
use crate::utils::helpers::{exe, get_host_target};
@@ -801,7 +803,8 @@ impl Config {
801803
}
802804
rustc
803805
} else {
804-
config.download_beta_toolchain();
806+
let dwn_ctx = DownloadContext::from(&config);
807+
download_beta_toolchain(dwn_ctx);
805808
config
806809
.out
807810
.join(config.host_target)
@@ -827,7 +830,8 @@ impl Config {
827830
}
828831
cargo
829832
} else {
830-
config.download_beta_toolchain();
833+
let dwn_ctx = DownloadContext::from(&config);
834+
download_beta_toolchain(dwn_ctx);
831835
config.initial_sysroot.join("bin").join(exe("cargo", config.host_target))
832836
};
833837

@@ -994,8 +998,12 @@ impl Config {
994998

995999
config.apply_dist_config(toml.dist);
9961000

997-
config.initial_rustfmt =
998-
if let Some(r) = rustfmt { Some(r) } else { config.maybe_download_rustfmt() };
1001+
config.initial_rustfmt = if let Some(r) = rustfmt {
1002+
Some(r)
1003+
} else {
1004+
let dwn_ctx = DownloadContext::from(&config);
1005+
maybe_download_rustfmt(dwn_ctx)
1006+
};
9991007

10001008
if matches!(config.lld_mode, LldMode::SelfContained)
10011009
&& !config.lld_enabled

src/bootstrap/src/core/download.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,6 @@ impl Config {
128128
cargo_clippy
129129
}
130130

131-
/// NOTE: rustfmt is a completely different toolchain than the bootstrap compiler, so it can't
132-
/// reuse target directories or artifacts
133-
pub(crate) fn maybe_download_rustfmt(&self) -> Option<PathBuf> {
134-
let dwn_ctx: DownloadContext<'_> = self.into();
135-
maybe_download_rustfmt(dwn_ctx)
136-
}
137-
138131
pub(crate) fn ci_rust_std_contents(&self) -> Vec<String> {
139132
self.ci_component_contents(".rust-std-contents")
140133
}
@@ -172,11 +165,6 @@ impl Config {
172165
);
173166
}
174167

175-
pub(crate) fn download_beta_toolchain(&self) {
176-
let dwn_ctx: DownloadContext<'_> = self.into();
177-
download_beta_toolchain(dwn_ctx);
178-
}
179-
180168
fn download_toolchain(
181169
&self,
182170
version: &str,

0 commit comments

Comments
 (0)