@@ -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+ } ;
4951use crate :: utils:: channel;
5052use crate :: utils:: exec:: { ExecutionContext , command} ;
5153use crate :: utils:: helpers:: { exe, get_host_target} ;
@@ -795,13 +797,19 @@ impl Config {
795797 ) ;
796798 }
797799
800+ config. patch_binaries_for_nix = patch_binaries_for_nix;
801+ config. bootstrap_cache_path = bootstrap_cache_path;
802+ config. llvm_assertions =
803+ toml. llvm . as_ref ( ) . is_some_and ( |llvm| llvm. assertions . unwrap_or ( false ) ) ;
804+
798805 config. initial_rustc = if let Some ( rustc) = rustc {
799806 if !flags_skip_stage0_validation {
800807 config. check_stage0_version ( & rustc, "rustc" ) ;
801808 }
802809 rustc
803810 } else {
804- config. download_beta_toolchain ( ) ;
811+ let dwn_ctx = DownloadContext :: from ( & config) ;
812+ download_beta_toolchain ( dwn_ctx) ;
805813 config
806814 . out
807815 . join ( config. host_target )
@@ -827,7 +835,8 @@ impl Config {
827835 }
828836 cargo
829837 } else {
830- config. download_beta_toolchain ( ) ;
838+ let dwn_ctx = DownloadContext :: from ( & config) ;
839+ download_beta_toolchain ( dwn_ctx) ;
831840 config. initial_sysroot . join ( "bin" ) . join ( exe ( "cargo" , config. host_target ) )
832841 } ;
833842
@@ -863,7 +872,6 @@ impl Config {
863872 config. reuse = reuse. map ( PathBuf :: from) ;
864873 config. submodules = submodules;
865874 config. android_ndk = android_ndk;
866- config. bootstrap_cache_path = bootstrap_cache_path;
867875 set ( & mut config. low_priority , low_priority) ;
868876 set ( & mut config. compiler_docs , compiler_docs) ;
869877 set ( & mut config. library_docs_private_items , library_docs_private_items) ;
@@ -882,7 +890,6 @@ impl Config {
882890 set ( & mut config. local_rebuild , local_rebuild) ;
883891 set ( & mut config. print_step_timings , print_step_timings) ;
884892 set ( & mut config. print_step_rusage , print_step_rusage) ;
885- config. patch_binaries_for_nix = patch_binaries_for_nix;
886893
887894 config. verbose = cmp:: max ( config. verbose , flags_verbose as usize ) ;
888895
@@ -891,9 +898,6 @@ impl Config {
891898
892899 config. apply_install_config ( toml. install ) ;
893900
894- config. llvm_assertions =
895- toml. llvm . as_ref ( ) . is_some_and ( |llvm| llvm. assertions . unwrap_or ( false ) ) ;
896-
897901 let file_content = t ! ( fs:: read_to_string( config. src. join( "src/ci/channel" ) ) ) ;
898902 let ci_channel = file_content. trim_end ( ) ;
899903
@@ -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
0 commit comments