@@ -45,7 +45,9 @@ use crate::core::config::{
45
45
DebuginfoLevel , DryRun , GccCiMode , LlvmLibunwind , Merge , ReplaceOpt , RustcLto , SplitDebuginfo ,
46
46
StringOrBool , set, threads_from_config,
47
47
} ;
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
+ } ;
49
51
use crate :: utils:: channel;
50
52
use crate :: utils:: exec:: { ExecutionContext , command} ;
51
53
use crate :: utils:: helpers:: { exe, get_host_target} ;
@@ -795,13 +797,19 @@ impl Config {
795
797
) ;
796
798
}
797
799
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
+
798
805
config. initial_rustc = if let Some ( rustc) = rustc {
799
806
if !flags_skip_stage0_validation {
800
807
config. check_stage0_version ( & rustc, "rustc" ) ;
801
808
}
802
809
rustc
803
810
} else {
804
- config. download_beta_toolchain ( ) ;
811
+ let dwn_ctx = DownloadContext :: from ( & config) ;
812
+ download_beta_toolchain ( dwn_ctx) ;
805
813
config
806
814
. out
807
815
. join ( config. host_target )
@@ -827,7 +835,8 @@ impl Config {
827
835
}
828
836
cargo
829
837
} else {
830
- config. download_beta_toolchain ( ) ;
838
+ let dwn_ctx = DownloadContext :: from ( & config) ;
839
+ download_beta_toolchain ( dwn_ctx) ;
831
840
config. initial_sysroot . join ( "bin" ) . join ( exe ( "cargo" , config. host_target ) )
832
841
} ;
833
842
@@ -863,7 +872,6 @@ impl Config {
863
872
config. reuse = reuse. map ( PathBuf :: from) ;
864
873
config. submodules = submodules;
865
874
config. android_ndk = android_ndk;
866
- config. bootstrap_cache_path = bootstrap_cache_path;
867
875
set ( & mut config. low_priority , low_priority) ;
868
876
set ( & mut config. compiler_docs , compiler_docs) ;
869
877
set ( & mut config. library_docs_private_items , library_docs_private_items) ;
@@ -882,7 +890,6 @@ impl Config {
882
890
set ( & mut config. local_rebuild , local_rebuild) ;
883
891
set ( & mut config. print_step_timings , print_step_timings) ;
884
892
set ( & mut config. print_step_rusage , print_step_rusage) ;
885
- config. patch_binaries_for_nix = patch_binaries_for_nix;
886
893
887
894
config. verbose = cmp:: max ( config. verbose , flags_verbose as usize ) ;
888
895
@@ -891,9 +898,6 @@ impl Config {
891
898
892
899
config. apply_install_config ( toml. install ) ;
893
900
894
- config. llvm_assertions =
895
- toml. llvm . as_ref ( ) . is_some_and ( |llvm| llvm. assertions . unwrap_or ( false ) ) ;
896
-
897
901
let file_content = t ! ( fs:: read_to_string( config. src. join( "src/ci/channel" ) ) ) ;
898
902
let ci_channel = file_content. trim_end ( ) ;
899
903
@@ -994,8 +998,12 @@ impl Config {
994
998
995
999
config. apply_dist_config ( toml. dist ) ;
996
1000
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
+ } ;
999
1007
1000
1008
if matches ! ( config. lld_mode, LldMode :: SelfContained )
1001
1009
&& !config. lld_enabled
0 commit comments