@@ -509,7 +509,7 @@ impl Config {
509
509
// TOML values by accident instead, because flags have higher priority.
510
510
let Build {
511
511
description : build_description,
512
- build : mut build_build,
512
+ build : build_build,
513
513
host : build_host,
514
514
target : build_target,
515
515
build_dir : build_build_dir,
@@ -556,7 +556,7 @@ impl Config {
556
556
metrics : _,
557
557
android_ndk : build_android_ndk,
558
558
optimized_compiler_builtins : build_optimized_compiler_builtins,
559
- jobs : mut build_jobs,
559
+ jobs : build_jobs,
560
560
compiletest_diff_tool : build_compiletest_diff_tool,
561
561
compiletest_use_stage0_libtest : build_compiletest_use_stage0_libtest,
562
562
tidy_extra_checks : build_tidy_extra_checks,
@@ -811,21 +811,59 @@ impl Config {
811
811
let rust_codegen_backends = rust_codegen_backends_
812
812
. map ( |backends| parse_codegen_backends ( backends, "rust" ) )
813
813
. unwrap_or ( vec ! [ CodegenBackendKind :: Llvm ] ) ;
814
-
815
- let mut ccache = None ;
816
- let mut submodules = None ;
817
- let mut target_config = HashMap :: new ( ) ;
818
- let mut download_rustc_commit = None ;
819
814
let deny_warnings = match flags_warnings {
820
815
Warnings :: Deny => true ,
821
816
Warnings :: Warn => false ,
822
817
Warnings :: Default => rust_deny_warnings. unwrap_or ( true ) ,
823
818
} ;
824
- let mut llvm_assertions = false ;
819
+ let ccache = match build_ccache {
820
+ Some ( StringOrBool :: String ( s) ) => Some ( s) ,
821
+ Some ( StringOrBool :: Bool ( true ) ) => Some ( "ccache" . to_string ( ) ) ,
822
+ _ => None ,
823
+ } ;
824
+
825
+ if rust_optimize_. as_ref ( ) . is_some_and ( |v| matches ! ( v, RustOptimize :: Bool ( false ) ) ) {
826
+ eprintln ! (
827
+ "WARNING: setting `optimize` to `false` is known to cause errors and \
828
+ should be considered unsupported. Refer to `bootstrap.example.toml` \
829
+ for more details."
830
+ ) ;
831
+ }
832
+ let rust_codegen_units = rust_codegen_units_. map ( threads_from_config) ;
833
+ let rust_codegen_units_std = rust_codegen_units_std_. map ( threads_from_config) ;
834
+ let rust_optimize = rust_optimize_. unwrap_or ( RustOptimize :: Bool ( true ) ) ;
835
+ let gcc_ci_mode = match gcc_download_ci_gcc {
836
+ Some ( value) => match value {
837
+ true => GccCiMode :: DownloadFromCi ,
838
+ false => GccCiMode :: BuildLocally ,
839
+ } ,
840
+ None => GccCiMode :: default ( ) ,
841
+ } ;
842
+ let jobs = Some ( threads_from_config ( flags_jobs. or ( build_jobs) . unwrap_or ( 0 ) ) ) ;
843
+ let host_target = flags_build
844
+ . or ( build_build)
845
+ . map ( |build| TargetSelection :: from_user ( & build) )
846
+ . unwrap_or_else ( get_host_target) ;
847
+
848
+ let submodules = build_submodules;
849
+ let llvm_assertions = llvm_assertions_. unwrap_or ( false ) ;
850
+ let compiletest_diff_tool = build_compiletest_diff_tool;
851
+ let compiletest_use_stage0_libtest = build_compiletest_use_stage0_libtest. unwrap_or ( true ) ;
852
+ let tidy_extra_checks = build_tidy_extra_checks;
853
+ let explicit_stage_from_config = build_test_stage. is_some ( )
854
+ || build_build_stage. is_some ( )
855
+ || build_doc_stage. is_some ( )
856
+ || build_dist_stage. is_some ( )
857
+ || build_install_stage. is_some ( )
858
+ || build_check_stage. is_some ( )
859
+ || build_bench_stage. is_some ( ) ;
860
+ let description = build_description;
861
+
862
+ let mut target_config = HashMap :: new ( ) ;
863
+ let mut download_rustc_commit = None ;
825
864
let llvm_link_shared = Cell :: default ( ) ;
826
865
let mut llvm_from_ci = false ;
827
866
let mut lld_enabled = false ;
828
- let mut host_target = get_host_target ( ) ;
829
867
let mut channel = "dev" . to_string ( ) ;
830
868
let mut out = PathBuf :: from ( "build" ) ;
831
869
let mut rust_info = GitInfo :: Absent ;
@@ -840,9 +878,6 @@ impl Config {
840
878
build_cargo = build_cargo. take ( ) . or ( std:: env:: var_os ( "CARGO" ) . map ( |p| p. into ( ) ) ) ;
841
879
}
842
880
843
- build_jobs = flags_jobs. or ( build_jobs) ;
844
- build_build = flags_build. or ( build_build) ;
845
-
846
881
let build_dir_ = flags_build_dir. or ( build_build_dir. map ( PathBuf :: from) ) ;
847
882
let host_ = if let Some ( TargetSelectionList ( hosts) ) = flags_host {
848
883
Some ( hosts)
@@ -886,6 +921,13 @@ impl Config {
886
921
. to_path_buf ( ) ;
887
922
}
888
923
924
+ #[ cfg( feature = "tracing" ) ]
925
+ span ! (
926
+ target: "CONFIG_HANDLING" ,
927
+ tracing:: Level :: TRACE ,
928
+ "normalizing and combining `flag.skip`/`flag.exclude` paths" ,
929
+ "config.skip" = ?skip,
930
+ ) ;
889
931
let skip = paths_
890
932
. into_iter ( )
891
933
. map ( |p| {
@@ -900,19 +942,6 @@ impl Config {
900
942
} )
901
943
. collect ( ) ;
902
944
903
- #[ cfg( feature = "tracing" ) ]
904
- span ! (
905
- target: "CONFIG_HANDLING" ,
906
- tracing:: Level :: TRACE ,
907
- "normalizing and combining `flag.skip`/`flag.exclude` paths" ,
908
- "config.skip" = ?skip,
909
- ) ;
910
-
911
- let jobs = Some ( threads_from_config ( build_jobs. unwrap_or ( 0 ) ) ) ;
912
- if let Some ( build) = build_build {
913
- host_target = TargetSelection :: from_user ( & build) ;
914
- }
915
-
916
945
set ( & mut out, build_dir_) ;
917
946
// NOTE: Bootstrap spawns various commands with different working directories.
918
947
// To avoid writing to random places on the file system, `config.out` needs to be an absolute path.
@@ -1002,10 +1031,6 @@ impl Config {
1002
1031
hosts. clone ( )
1003
1032
} ;
1004
1033
1005
- submodules = build_submodules;
1006
-
1007
- llvm_assertions = llvm_assertions_. unwrap_or ( false ) ;
1008
-
1009
1034
let file_content = t ! ( fs:: read_to_string( src. join( "src/ci/channel" ) ) ) ;
1010
1035
let ci_channel = file_content. trim_end ( ) ;
1011
1036
@@ -1160,19 +1185,6 @@ impl Config {
1160
1185
}
1161
1186
}
1162
1187
1163
- if rust_optimize_. as_ref ( ) . is_some_and ( |v| matches ! ( v, RustOptimize :: Bool ( false ) ) ) {
1164
- eprintln ! (
1165
- "WARNING: setting `optimize` to `false` is known to cause errors and \
1166
- should be considered unsupported. Refer to `bootstrap.example.toml` \
1167
- for more details."
1168
- ) ;
1169
- }
1170
-
1171
- let rust_codegen_units = rust_codegen_units_. map ( threads_from_config) ;
1172
- let rust_codegen_units_std = rust_codegen_units_std_. map ( threads_from_config) ;
1173
-
1174
- let rust_optimize = rust_optimize_. unwrap_or ( RustOptimize :: Bool ( true ) ) ;
1175
-
1176
1188
// We make `x86_64-unknown-linux-gnu` use the self-contained linker by default, so we will
1177
1189
// build our internal lld and use it as the default linker, by setting the `rust.lld` config
1178
1190
// to true by default:
@@ -1198,8 +1210,6 @@ impl Config {
1198
1210
set ( & mut lld_enabled, rust_lld_enabled) ;
1199
1211
}
1200
1212
1201
- let description = build_description;
1202
-
1203
1213
// We need to override `rust.channel` if it's manually specified when using the CI rustc.
1204
1214
// This is because if the compiler uses a different channel than the one specified in bootstrap.toml,
1205
1215
// tests may fail due to using a different channel than the one used by the compiler during tests.
@@ -1298,22 +1308,6 @@ impl Config {
1298
1308
llvm_link_shared. set ( Some ( true ) ) ;
1299
1309
}
1300
1310
1301
- let gcc_ci_mode = match gcc_download_ci_gcc {
1302
- Some ( value) => match value {
1303
- true => GccCiMode :: DownloadFromCi ,
1304
- false => GccCiMode :: BuildLocally ,
1305
- } ,
1306
- None => GccCiMode :: default ( ) ,
1307
- } ;
1308
-
1309
- match build_ccache {
1310
- Some ( StringOrBool :: String ( ref s) ) => ccache = Some ( s. to_string ( ) ) ,
1311
- Some ( StringOrBool :: Bool ( true ) ) => {
1312
- ccache = Some ( "ccache" . to_string ( ) ) ;
1313
- }
1314
- Some ( StringOrBool :: Bool ( false ) ) | None => { }
1315
- }
1316
-
1317
1311
if llvm_from_ci {
1318
1312
let triple = & host_target. triple ;
1319
1313
let dwn_ctx = DownloadContext :: new (
@@ -1403,18 +1397,8 @@ impl Config {
1403
1397
1404
1398
let optimized_compiler_builtins =
1405
1399
build_optimized_compiler_builtins. unwrap_or ( channel != "dev" ) ;
1406
- let compiletest_diff_tool = build_compiletest_diff_tool;
1407
- let compiletest_use_stage0_libtest = build_compiletest_use_stage0_libtest. unwrap_or ( true ) ;
1408
- let tidy_extra_checks = build_tidy_extra_checks;
1409
1400
1410
1401
let download_rustc = download_rustc_commit. is_some ( ) ;
1411
- let explicit_stage_from_config = build_test_stage. is_some ( )
1412
- || build_build_stage. is_some ( )
1413
- || build_doc_stage. is_some ( )
1414
- || build_dist_stage. is_some ( )
1415
- || build_install_stage. is_some ( )
1416
- || build_check_stage. is_some ( )
1417
- || build_bench_stage. is_some ( ) ;
1418
1402
1419
1403
let stage = match cmd {
1420
1404
Subcommand :: Check { .. } => flags_stage. or ( build_check_stage) . unwrap_or ( 1 ) ,
0 commit comments