@@ -738,27 +738,28 @@ impl Config {
738
738
) ;
739
739
}
740
740
741
+ let mut dwn_ctx = DownloadContext :: new (
742
+ path_modification_cache. clone ( ) ,
743
+ & src,
744
+ rust_info. clone ( ) ,
745
+ & submodules,
746
+ download_rustc_commit. clone ( ) ,
747
+ host_target,
748
+ llvm_from_ci,
749
+ target_config. clone ( ) ,
750
+ out. clone ( ) ,
751
+ patch_binaries_for_nix,
752
+ & exec_ctx,
753
+ & stage0_metadata,
754
+ llvm_assertions,
755
+ & bootstrap_cache_path,
756
+ is_running_on_ci,
757
+ ) ;
758
+
741
759
let initial_rustc = if let Some ( rustc) = build_rustc {
742
760
rustc
743
761
} else {
744
- let dwn_ctx = DownloadContext :: new (
745
- path_modification_cache. clone ( ) ,
746
- & src,
747
- & rust_info,
748
- & submodules,
749
- & download_rustc_commit,
750
- host_target,
751
- llvm_from_ci,
752
- & target_config,
753
- & out,
754
- patch_binaries_for_nix,
755
- & exec_ctx,
756
- & stage0_metadata,
757
- llvm_assertions,
758
- & bootstrap_cache_path,
759
- is_running_on_ci,
760
- ) ;
761
- download_beta_toolchain ( dwn_ctx) ;
762
+ download_beta_toolchain ( & dwn_ctx) ;
762
763
out. join ( host_target) . join ( "stage0" ) . join ( "bin" ) . join ( exe ( "rustc" , host_target) )
763
764
} ;
764
765
@@ -776,24 +777,7 @@ impl Config {
776
777
let initial_cargo = if let Some ( cargo) = build_cargo {
777
778
cargo
778
779
} else {
779
- let dwn_ctx = DownloadContext :: new (
780
- path_modification_cache. clone ( ) ,
781
- & src,
782
- & rust_info,
783
- & submodules,
784
- & download_rustc_commit,
785
- host_target,
786
- llvm_from_ci,
787
- & target_config,
788
- & out,
789
- patch_binaries_for_nix,
790
- & exec_ctx,
791
- & stage0_metadata,
792
- llvm_assertions,
793
- & bootstrap_cache_path,
794
- is_running_on_ci,
795
- ) ;
796
- download_beta_toolchain ( dwn_ctx) ;
780
+ download_beta_toolchain ( & dwn_ctx) ;
797
781
initial_sysroot. join ( "bin" ) . join ( exe ( "cargo" , host_target) )
798
782
} ;
799
783
@@ -802,6 +786,7 @@ impl Config {
802
786
let dir = out. join ( "tmp-dry-run" ) ;
803
787
t ! ( fs:: create_dir_all( & dir) ) ;
804
788
out = dir;
789
+ dwn_ctx. out = out. clone ( ) ;
805
790
}
806
791
807
792
let file_content = t ! ( fs:: read_to_string( src. join( "src/ci/channel" ) ) ) ;
@@ -822,6 +807,7 @@ impl Config {
822
807
let omit_git_hash = rust_omit_git_hash. unwrap_or ( channel == "dev" ) ;
823
808
824
809
rust_info = git_info ( & exec_ctx, omit_git_hash, & src) ;
810
+ dwn_ctx. rust_info = rust_info. clone ( ) ;
825
811
826
812
let vendor = build_vendor. unwrap_or (
827
813
rust_info. is_from_tarball ( )
@@ -858,25 +844,9 @@ impl Config {
858
844
) ;
859
845
}
860
846
861
- let dwn_ctx = DownloadContext :: new (
862
- path_modification_cache. clone ( ) ,
863
- & src,
864
- & rust_info,
865
- & submodules,
866
- & download_rustc_commit,
867
- host_target,
868
- llvm_from_ci,
869
- & target_config,
870
- & out,
871
- patch_binaries_for_nix,
872
- & exec_ctx,
873
- & stage0_metadata,
874
- llvm_assertions,
875
- & bootstrap_cache_path,
876
- is_running_on_ci,
877
- ) ;
878
847
download_rustc_commit =
879
- download_ci_rustc_commit ( dwn_ctx, rust_download_rustc, llvm_assertions) ;
848
+ download_ci_rustc_commit ( & dwn_ctx, rust_download_rustc, llvm_assertions) ;
849
+ dwn_ctx. download_rustc_commit = download_rustc_commit. clone ( ) ;
880
850
881
851
if debug_assertions_requested {
882
852
eprintln ! (
@@ -885,6 +855,7 @@ impl Config {
885
855
) ;
886
856
// We need to put this later down_ci_rustc_commit.
887
857
download_rustc_commit = None ;
858
+ dwn_ctx. download_rustc_commit = None ;
888
859
}
889
860
890
861
if let Some ( t) = toml. target {
@@ -946,6 +917,7 @@ impl Config {
946
917
947
918
target_config. insert ( TargetSelection :: from_user ( & triple) , target) ;
948
919
}
920
+ dwn_ctx. target_config = target_config. clone ( ) ;
949
921
}
950
922
951
923
// We make `x86_64-unknown-linux-gnu` use the self-contained linker by default, so we will
@@ -983,25 +955,9 @@ impl Config {
983
955
"WARNING: `rust.download-rustc` is enabled. The `rust.channel` option will be overridden by the CI rustc's channel."
984
956
) ;
985
957
986
- let dwn_ctx = DownloadContext :: new (
987
- path_modification_cache. clone ( ) ,
988
- & src,
989
- & rust_info,
990
- & submodules,
991
- & download_rustc_commit,
992
- host_target,
993
- llvm_from_ci,
994
- & target_config,
995
- & out,
996
- patch_binaries_for_nix,
997
- & exec_ctx,
998
- & stage0_metadata,
999
- llvm_assertions,
1000
- & bootstrap_cache_path,
1001
- is_running_on_ci,
1002
- ) ;
1003
- let channel_ =
1004
- read_file_by_commit ( dwn_ctx, Path :: new ( "src/ci/channel" ) , commit) . trim ( ) . to_owned ( ) ;
958
+ let channel_ = read_file_by_commit ( & dwn_ctx, Path :: new ( "src/ci/channel" ) , commit)
959
+ . trim ( )
960
+ . to_owned ( ) ;
1005
961
1006
962
channel = channel_;
1007
963
}
@@ -1010,24 +966,8 @@ impl Config {
1010
966
llvm_link_shared. set ( Some ( v) ) ;
1011
967
}
1012
968
1013
- let dwn_ctx = DownloadContext :: new (
1014
- path_modification_cache. clone ( ) ,
1015
- & src,
1016
- & rust_info,
1017
- & submodules,
1018
- & download_rustc_commit,
1019
- host_target,
1020
- llvm_from_ci,
1021
- & target_config,
1022
- & out,
1023
- patch_binaries_for_nix,
1024
- & exec_ctx,
1025
- & stage0_metadata,
1026
- llvm_assertions,
1027
- & bootstrap_cache_path,
1028
- is_running_on_ci,
1029
- ) ;
1030
- llvm_from_ci = parse_download_ci_llvm ( dwn_ctx, llvm_download_ci_llvm, llvm_assertions) ;
969
+ llvm_from_ci = parse_download_ci_llvm ( & dwn_ctx, llvm_download_ci_llvm, llvm_assertions) ;
970
+ dwn_ctx. llvm_from_ci = llvm_from_ci;
1031
971
1032
972
if llvm_from_ci {
1033
973
let warn = |option : & str | {
@@ -1073,55 +1013,19 @@ impl Config {
1073
1013
1074
1014
if llvm_from_ci {
1075
1015
let triple = & host_target. triple ;
1076
- let dwn_ctx = DownloadContext :: new (
1077
- path_modification_cache. clone ( ) ,
1078
- & src,
1079
- & rust_info,
1080
- & submodules,
1081
- & download_rustc_commit,
1082
- host_target,
1083
- llvm_from_ci,
1084
- & target_config,
1085
- & out,
1086
- patch_binaries_for_nix,
1087
- & exec_ctx,
1088
- & stage0_metadata,
1089
- llvm_assertions,
1090
- & bootstrap_cache_path,
1091
- is_running_on_ci,
1092
- ) ;
1093
- let ci_llvm_bin = ci_llvm_root ( dwn_ctx) . join ( "bin" ) ;
1016
+ let ci_llvm_bin = ci_llvm_root ( & dwn_ctx) . join ( "bin" ) ;
1094
1017
let build_target =
1095
1018
target_config. entry ( host_target) . or_insert_with ( || Target :: from_triple ( triple) ) ;
1019
+ dwn_ctx. target_config . entry ( host_target) . or_insert_with ( || Target :: from_triple ( triple) ) ;
1096
1020
1097
1021
check_ci_llvm ! ( build_target. llvm_config) ;
1098
1022
check_ci_llvm ! ( build_target. llvm_filecheck) ;
1099
1023
build_target. llvm_config = Some ( ci_llvm_bin. join ( exe ( "llvm-config" , host_target) ) ) ;
1100
1024
build_target. llvm_filecheck = Some ( ci_llvm_bin. join ( exe ( "FileCheck" , host_target) ) ) ;
1101
1025
}
1102
1026
1103
- let initial_rustfmt = if let Some ( r) = build_rustfmt {
1104
- Some ( r)
1105
- } else {
1106
- let dwn_ctx = DownloadContext :: new (
1107
- path_modification_cache. clone ( ) ,
1108
- & src,
1109
- & rust_info,
1110
- & submodules,
1111
- & download_rustc_commit,
1112
- host_target,
1113
- llvm_from_ci,
1114
- & target_config,
1115
- & out,
1116
- patch_binaries_for_nix,
1117
- & exec_ctx,
1118
- & stage0_metadata,
1119
- llvm_assertions,
1120
- & bootstrap_cache_path,
1121
- is_running_on_ci,
1122
- ) ;
1123
- maybe_download_rustfmt ( dwn_ctx)
1124
- } ;
1027
+ let initial_rustfmt =
1028
+ if let Some ( r) = build_rustfmt { Some ( r) } else { maybe_download_rustfmt ( & dwn_ctx) } ;
1125
1029
1126
1030
if matches ! ( rust_lld_mode. unwrap_or_default( ) , LldMode :: SelfContained )
1127
1031
&& !lld_enabled
@@ -1132,24 +1036,7 @@ impl Config {
1132
1036
) ;
1133
1037
}
1134
1038
1135
- let dwn_ctx = DownloadContext :: new (
1136
- path_modification_cache. clone ( ) ,
1137
- & src,
1138
- & rust_info,
1139
- & submodules,
1140
- & download_rustc_commit,
1141
- host_target,
1142
- llvm_from_ci,
1143
- & target_config,
1144
- & out,
1145
- patch_binaries_for_nix,
1146
- & exec_ctx,
1147
- & stage0_metadata,
1148
- llvm_assertions,
1149
- & bootstrap_cache_path,
1150
- is_running_on_ci,
1151
- ) ;
1152
- if lld_enabled && is_system_llvm ( dwn_ctx, host_target) {
1039
+ if lld_enabled && is_system_llvm ( & dwn_ctx, host_target) {
1153
1040
panic ! ( "Cannot enable LLD with `rust.lld = true` when using external llvm-config." ) ;
1154
1041
}
1155
1042
@@ -2365,7 +2252,7 @@ pub fn has_changes_from_upstream<'a>(
2365
2252
) ]
2366
2253
pub ( crate ) fn update_submodule < ' a > ( dwn_ctx : impl AsRef < DownloadContext < ' a > > , relative_path : & str ) {
2367
2254
let dwn_ctx = dwn_ctx. as_ref ( ) ;
2368
- if dwn_ctx. rust_info . is_from_tarball ( ) || !submodules_ ( dwn_ctx. submodules , dwn_ctx. rust_info ) {
2255
+ if dwn_ctx. rust_info . is_from_tarball ( ) || !submodules_ ( dwn_ctx. submodules , & dwn_ctx. rust_info ) {
2369
2256
return ;
2370
2257
}
2371
2258
0 commit comments