@@ -478,13 +478,12 @@ impl Config {
478
478
479
479
// Now load the TOML config, as soon as possible
480
480
let ( mut toml, toml_path) = load_toml_config ( & src, flags_config, & get_toml) ;
481
- let config = toml_path. clone ( ) ;
482
481
483
482
let compile_time_deps = flags_compile_time_deps;
484
483
let cmd = flags_cmd;
485
484
let is_running_on_ci = flags_ci. unwrap_or ( CiEnv :: is_ci ( ) ) ;
486
485
487
- postprocess_toml ( & mut toml, & src, toml_path, & exec_ctx, & flags_set, & get_toml) ;
486
+ postprocess_toml ( & mut toml, & src, toml_path. clone ( ) , & exec_ctx, & flags_set, & get_toml) ;
488
487
489
488
// Now override TOML values with flags, to make sure that we won't later override flags with
490
489
// TOML values by accident instead, because flags have higher priority.
@@ -660,13 +659,8 @@ impl Config {
660
659
exec_ctx. set_verbosity ( cmp:: max ( build_verbose. unwrap_or_default ( ) as u8 , flags_verbose) ) ;
661
660
662
661
let stage0_metadata = build_helper:: stage0_parser:: parse_stage0_file ( ) ;
663
- let llvm_thin_lto = llvm_thin_lto_. unwrap_or ( false ) ;
664
- let lld_mode = rust_lld_mode. unwrap_or_default ( ) ;
665
662
let bootstrap_cache_path = build_bootstrap_cache_path;
666
663
let patch_binaries_for_nix = build_patch_binaries_for_nix;
667
- let rustc_debug_assertions =
668
- rust_rustc_debug_assertions. unwrap_or ( rust_debug == Some ( true ) ) ;
669
- let rust_overflow_checks = rust_overflow_checks_. unwrap_or ( rust_debug == Some ( true ) ) ;
670
664
671
665
let path_modification_cache = Arc :: new ( Mutex :: new ( HashMap :: new ( ) ) ) ;
672
666
@@ -688,12 +682,6 @@ impl Config {
688
682
build_host. map ( |h| h. iter ( ) . map ( |t| TargetSelection :: from_user ( t) ) . collect ( ) )
689
683
} )
690
684
. unwrap_or_else ( || vec ! [ host_target] ) ;
691
- let targets = flags_target
692
- . map ( |TargetSelectionList ( targets) | targets)
693
- . or_else ( || {
694
- build_target. map ( |t| t. iter ( ) . map ( |t| TargetSelection :: from_user ( t) ) . collect ( ) )
695
- } )
696
- . unwrap_or_else ( || hosts. clone ( ) ) ;
697
685
698
686
let submodules = build_submodules;
699
687
let llvm_assertions = llvm_assertions_. unwrap_or ( false ) ;
@@ -744,32 +732,6 @@ impl Config {
744
732
}
745
733
}
746
734
747
- let mut paths_: Vec < PathBuf > = flags_skip. into_iter ( ) . chain ( flags_exclude) . collect ( ) ;
748
- if let Some ( exclude) = build_exclude {
749
- paths_. extend ( exclude) ;
750
- }
751
-
752
- let skip = paths_
753
- . into_iter ( )
754
- . map ( |p| {
755
- // Never return top-level path here as it would break `--skip`
756
- // logic on rustc's internal test framework which is utilized
757
- // by compiletest.
758
- if cfg ! ( windows) {
759
- PathBuf :: from ( p. to_str ( ) . unwrap ( ) . replace ( '/' , "\\ " ) )
760
- } else {
761
- p
762
- }
763
- } )
764
- . collect ( ) ;
765
- #[ cfg( feature = "tracing" ) ]
766
- span ! (
767
- target: "CONFIG_HANDLING" ,
768
- tracing:: Level :: TRACE ,
769
- "normalizing and combining `flag.skip`/`flag.exclude` paths" ,
770
- "config.skip" = ?skip,
771
- ) ;
772
-
773
735
if build_cargo_clippy. is_some ( ) && build_rustc. is_none ( ) {
774
736
println ! (
775
737
"WARNING: Using `build.cargo-clippy` without `build.rustc` usually fails due to toolchain conflict."
@@ -860,15 +822,6 @@ impl Config {
860
822
let omit_git_hash = rust_omit_git_hash. unwrap_or ( channel == "dev" ) ;
861
823
862
824
rust_info = git_info ( & exec_ctx, omit_git_hash, & src) ;
863
- let cargo_info = git_info ( & exec_ctx, omit_git_hash, & src. join ( "src/tools/cargo" ) ) ;
864
- let rust_analyzer_info =
865
- git_info ( & exec_ctx, omit_git_hash, & src. join ( "src/tools/rust-analyzer" ) ) ;
866
- let clippy_info = git_info ( & exec_ctx, omit_git_hash, & src. join ( "src/tools/clippy" ) ) ;
867
- let miri_info = git_info ( & exec_ctx, omit_git_hash, & src. join ( "src/tools/miri" ) ) ;
868
- let rustfmt_info = git_info ( & exec_ctx, omit_git_hash, & src. join ( "src/tools/rustfmt" ) ) ;
869
- let enzyme_info = git_info ( & exec_ctx, omit_git_hash, & src. join ( "src/tools/enzyme" ) ) ;
870
- let in_tree_llvm_info = git_info ( & exec_ctx, false , & src. join ( "src/llvm-project" ) ) ;
871
- let in_tree_gcc_info = git_info ( & exec_ctx, false , & src. join ( "src/gcc" ) ) ;
872
825
873
826
let vendor = build_vendor. unwrap_or (
874
827
rust_info. is_from_tarball ( )
@@ -1111,7 +1064,7 @@ impl Config {
1111
1064
}
1112
1065
}
1113
1066
1114
- if !llvm_from_ci && llvm_thin_lto && llvm_link_shared_. is_none ( ) {
1067
+ if !llvm_from_ci && llvm_thin_lto_ . unwrap_or ( false ) && llvm_link_shared_. is_none ( ) {
1115
1068
// If we're building with ThinLTO on, by default we want to link
1116
1069
// to LLVM shared, to avoid re-doing ThinLTO (which happens in
1117
1070
// the link step) with each stage.
@@ -1147,11 +1100,6 @@ impl Config {
1147
1100
build_target. llvm_filecheck = Some ( ci_llvm_bin. join ( exe ( "FileCheck" , host_target) ) ) ;
1148
1101
}
1149
1102
1150
- let dist_vendor = dist_vendor_. unwrap_or_else ( || {
1151
- // If we're building from git or tarball sources, enable it by default.
1152
- rust_info. is_managed_git_subrepository ( ) || rust_info. is_from_tarball ( )
1153
- } ) ;
1154
-
1155
1103
let initial_rustfmt = if let Some ( r) = build_rustfmt {
1156
1104
Some ( r)
1157
1105
} else {
@@ -1175,7 +1123,7 @@ impl Config {
1175
1123
maybe_download_rustfmt ( dwn_ctx)
1176
1124
} ;
1177
1125
1178
- if matches ! ( lld_mode , LldMode :: SelfContained )
1126
+ if matches ! ( rust_lld_mode . unwrap_or_default ( ) , LldMode :: SelfContained )
1179
1127
&& !lld_enabled
1180
1128
&& flags_stage. unwrap_or ( 0 ) > 0
1181
1129
{
@@ -1205,9 +1153,6 @@ impl Config {
1205
1153
panic ! ( "Cannot enable LLD with `rust.lld = true` when using external llvm-config." ) ;
1206
1154
}
1207
1155
1208
- let optimized_compiler_builtins =
1209
- build_optimized_compiler_builtins. unwrap_or ( channel != "dev" ) ;
1210
-
1211
1156
let download_rustc = download_rustc_commit. is_some ( ) ;
1212
1157
1213
1158
let stage = match cmd {
@@ -1328,7 +1273,8 @@ impl Config {
1328
1273
test_compare_mode : rust_test_compare_mode. unwrap_or ( false ) ,
1329
1274
color : flags_color,
1330
1275
android_ndk : build_android_ndk,
1331
- optimized_compiler_builtins,
1276
+ optimized_compiler_builtins : build_optimized_compiler_builtins
1277
+ . unwrap_or ( channel != "dev" ) ,
1332
1278
stdout_is_tty : std:: io:: stdout ( ) . is_terminal ( ) ,
1333
1279
stderr_is_tty : std:: io:: stderr ( ) . is_terminal ( ) ,
1334
1280
on_fail : flags_on_fail,
@@ -1388,10 +1334,19 @@ impl Config {
1388
1334
rust_optimize : rust_optimize_. unwrap_or ( RustOptimize :: Bool ( true ) ) ,
1389
1335
rust_codegen_units : rust_codegen_units_. map ( threads_from_config) ,
1390
1336
rust_codegen_units_std : rust_codegen_units_std_. map ( threads_from_config) ,
1391
- std_debug_assertions : rust_std_debug_assertions. unwrap_or ( rustc_debug_assertions) ,
1392
- tools_debug_assertions : rust_tools_debug_assertions. unwrap_or ( rustc_debug_assertions) ,
1393
- rust_overflow_checks_std : rust_overflow_checks_std_. unwrap_or ( rust_overflow_checks) ,
1394
- rust_debug_logging : rust_debug_logging_. unwrap_or ( rustc_debug_assertions) ,
1337
+ std_debug_assertions : rust_std_debug_assertions
1338
+ . or ( rust_rustc_debug_assertions)
1339
+ . unwrap_or ( rust_debug == Some ( true ) ) ,
1340
+ tools_debug_assertions : rust_tools_debug_assertions
1341
+ . or ( rust_rustc_debug_assertions)
1342
+ . unwrap_or ( rust_debug == Some ( true ) ) ,
1343
+ rust_overflow_checks_std : rust_overflow_checks_std_
1344
+ . or ( rust_overflow_checks_)
1345
+ . unwrap_or ( rust_debug == Some ( true ) ) ,
1346
+ rust_overflow_checks : rust_overflow_checks_. unwrap_or ( rust_debug == Some ( true ) ) ,
1347
+ rust_debug_logging : rust_debug_logging_
1348
+ . or ( rust_rustc_debug_assertions)
1349
+ . unwrap_or ( rust_debug == Some ( true ) ) ,
1395
1350
rust_debuginfo_level_rustc : with_defaults ( rust_debuginfo_level_rustc_) ,
1396
1351
rust_debuginfo_level_std : with_defaults ( rust_debuginfo_level_std_) ,
1397
1352
rust_debuginfo_level_tools : with_defaults ( rust_debuginfo_level_tools_) ,
@@ -1464,50 +1419,78 @@ impl Config {
1464
1419
compiletest_use_stage0_libtest : build_compiletest_use_stage0_libtest. unwrap_or ( true ) ,
1465
1420
tidy_extra_checks : build_tidy_extra_checks,
1466
1421
skip_std_check_if_no_download_rustc : flags_skip_std_check_if_no_download_rustc,
1422
+ cargo_info : git_info ( & exec_ctx, omit_git_hash, & src. join ( "src/tools/cargo" ) ) ,
1423
+ rust_analyzer_info : git_info (
1424
+ & exec_ctx,
1425
+ omit_git_hash,
1426
+ & src. join ( "src/tools/rust-analyzer" ) ,
1427
+ ) ,
1428
+ clippy_info : git_info ( & exec_ctx, omit_git_hash, & src. join ( "src/tools/clippy" ) ) ,
1429
+ miri_info : git_info ( & exec_ctx, omit_git_hash, & src. join ( "src/tools/miri" ) ) ,
1430
+ rustfmt_info : git_info ( & exec_ctx, omit_git_hash, & src. join ( "src/tools/rustfmt" ) ) ,
1431
+ enzyme_info : git_info ( & exec_ctx, omit_git_hash, & src. join ( "src/tools/enzyme" ) ) ,
1432
+ in_tree_llvm_info : git_info ( & exec_ctx, false , & src. join ( "src/llvm-project" ) ) ,
1433
+ in_tree_gcc_info : git_info ( & exec_ctx, false , & src. join ( "src/gcc" ) ) ,
1434
+ dist_vendor : dist_vendor_. unwrap_or_else ( || {
1435
+ // If we're building from git or tarball sources, enable it by default.
1436
+ rust_info. is_managed_git_subrepository ( ) || rust_info. is_from_tarball ( )
1437
+ } ) ,
1438
+ targets : flags_target
1439
+ . map ( |TargetSelectionList ( targets) | targets)
1440
+ . or_else ( || {
1441
+ build_target. map ( |t| t. iter ( ) . map ( |t| TargetSelection :: from_user ( t) ) . collect ( ) )
1442
+ } )
1443
+ . unwrap_or_else ( || hosts. clone ( ) ) ,
1444
+ #[ allow( clippy:: map_identity) ]
1445
+ skip : flags_skip
1446
+ . into_iter ( )
1447
+ . chain ( flags_exclude)
1448
+ . chain ( build_exclude. unwrap_or_default ( ) )
1449
+ . map ( |p| {
1450
+ // Never return top-level path here as it would break `--skip`
1451
+ // logic on rustc's internal test framework which is utilized by compiletest.
1452
+ #[ cfg( windows) ]
1453
+ {
1454
+ PathBuf :: from ( p. to_string_lossy ( ) . replace ( '/' , "\\ " ) )
1455
+ }
1456
+ #[ cfg( not( windows) ) ]
1457
+ {
1458
+ p
1459
+ }
1460
+ } )
1461
+ . collect ( ) ,
1462
+ paths : flags_paths,
1463
+ config : toml_path,
1464
+ llvm_thin_lto : llvm_thin_lto_. unwrap_or ( false ) ,
1465
+ rustc_debug_assertions : rust_rustc_debug_assertions. unwrap_or ( rust_debug == Some ( true ) ) ,
1466
+ lld_mode : rust_lld_mode. unwrap_or_default ( ) ,
1467
1467
exec_ctx,
1468
1468
out,
1469
1469
rust_info,
1470
- cargo_info,
1471
- rust_analyzer_info,
1472
- clippy_info,
1473
- miri_info,
1474
- rustfmt_info,
1475
- enzyme_info,
1476
- in_tree_llvm_info,
1477
- in_tree_gcc_info,
1478
1470
initial_cargo,
1479
1471
initial_rustc,
1480
1472
initial_cargo_clippy,
1481
1473
initial_sysroot,
1482
1474
initial_rustfmt,
1483
1475
submodules,
1484
- paths : flags_paths,
1485
1476
vendor,
1486
1477
target_config,
1487
1478
omit_git_hash,
1488
- skip,
1489
1479
stage,
1490
1480
src,
1491
- config,
1492
1481
cmd,
1493
1482
llvm_from_ci,
1494
1483
llvm_assertions,
1495
- lld_mode,
1496
1484
lld_enabled,
1497
- rust_overflow_checks,
1498
1485
host_target,
1499
1486
hosts,
1500
- targets,
1501
- dist_vendor,
1502
1487
channel,
1503
1488
is_running_on_ci,
1504
1489
path_modification_cache,
1505
1490
patch_binaries_for_nix,
1506
1491
stage0_metadata,
1507
1492
download_rustc_commit,
1508
- llvm_thin_lto,
1509
1493
llvm_link_shared,
1510
- rustc_debug_assertions,
1511
1494
}
1512
1495
}
1513
1496
0 commit comments