@@ -501,86 +501,85 @@ impl Config {
501501 // Now override TOML values with flags, to make sure that we won't later override flags with
502502 // TOML values by accident instead, because flags have higher priority.
503503 let Build {
504- description,
505- mut build ,
506- host,
507- target,
508- build_dir,
509- cargo,
510- rustc,
511- rustfmt,
512- cargo_clippy,
513- docs,
514- compiler_docs,
515- library_docs_private_items,
516- docs_minification,
517- submodules,
518- gdb,
519- lldb,
520- nodejs,
521- npm,
522- python,
523- reuse,
524- locked_deps,
525- vendor,
526- full_bootstrap,
527- bootstrap_cache_path,
528- extended,
529- tools,
530- tool,
531- verbose : build_verbose ,
532- sanitizers,
533- profiler,
534- cargo_native_static,
535- low_priority,
536- configure_args,
537- local_rebuild,
538- print_step_timings,
539- print_step_rusage,
540- check_stage,
541- doc_stage,
542- build_stage,
543- test_stage,
544- install_stage,
545- dist_stage,
546- bench_stage,
547- patch_binaries_for_nix,
504+ description : build_description_toml ,
505+ build : mut build_build_toml ,
506+ host : build_host_toml ,
507+ target : build_target_toml ,
508+ build_dir : build_build_dir_toml ,
509+ cargo : build_cargo_toml ,
510+ rustc : build_rustc_toml ,
511+ rustfmt : build_rustfmt_toml ,
512+ cargo_clippy : build_cargo_clippy_toml ,
513+ docs : build_docs_toml ,
514+ compiler_docs : build_compiler_docs_toml ,
515+ library_docs_private_items : build_library_docs_private_items_toml ,
516+ docs_minification : build_docs_minification_toml ,
517+ submodules : build_submodules_toml ,
518+ gdb : build_gdb_toml ,
519+ lldb : build_lldb_toml ,
520+ nodejs : build_nodejs_toml ,
521+ npm : build_npm_toml ,
522+ python : build_python_toml ,
523+ reuse : build_reuse_toml ,
524+ locked_deps : build_locked_deps_toml ,
525+ vendor : build_vendor_toml ,
526+ full_bootstrap : build_full_bootstrap_toml ,
527+ bootstrap_cache_path : build_bootstrap_cache_path_toml ,
528+ extended : build_extended_toml ,
529+ tools : build_tools_toml ,
530+ tool : build_tool_toml ,
531+ verbose : build_verbose_toml ,
532+ sanitizers : build_sanitizers_toml ,
533+ profiler : build_profiler_toml ,
534+ cargo_native_static : build_cargo_native_static_toml ,
535+ low_priority : build_low_priority_toml ,
536+ configure_args : build_configure_args_toml ,
537+ local_rebuild : build_local_rebuild_toml ,
538+ print_step_timings : build_print_step_timings_toml ,
539+ print_step_rusage : build_print_step_rusage_toml ,
540+ check_stage : build_check_stage_toml ,
541+ doc_stage : build_doc_stage_toml ,
542+ build_stage : build_build_stage_toml ,
543+ test_stage : build_test_stage_toml ,
544+ install_stage : build_install_stage_toml ,
545+ dist_stage : build_dist_stage_toml ,
546+ bench_stage : build_bench_stage_toml ,
547+ patch_binaries_for_nix : build_patch_binaries_for_nix_toml ,
548548 // This field is only used by bootstrap.py
549549 metrics : _,
550- android_ndk,
551- optimized_compiler_builtins,
552- mut jobs,
553- compiletest_diff_tool,
554- compiletest_allow_stage0,
555- compiletest_use_stage0_libtest,
556- tidy_extra_checks,
557- ccache,
558- exclude,
550+ android_ndk : build_android_ndk_toml,
551+ optimized_compiler_builtins : build_optimized_compiler_builtins_toml,
552+ jobs : mut build_jobs_toml,
553+ compiletest_diff_tool : build_compiletest_diff_tool_toml,
554+ compiletest_use_stage0_libtest : build_compiletest_use_stage0_libtest_toml,
555+ tidy_extra_checks : build_tidy_extra_checks_toml,
556+ ccache : build_ccache_toml,
557+ exclude : build_exclude_toml,
559558 } = toml. build . unwrap_or_default ( ) ;
560- jobs = flags_jobs. or ( jobs ) ;
561- build = flags_build. or ( build ) ;
562- let build_dir = flags_build_dir. or ( build_dir . map ( PathBuf :: from) ) ;
559+ build_jobs_toml = flags_jobs. or ( build_jobs_toml ) ;
560+ build_build_toml = flags_build. or ( build_build_toml ) ;
561+ let build_dir = flags_build_dir. or ( build_build_dir_toml . map ( PathBuf :: from) ) ;
563562 let host = if let Some ( TargetSelectionList ( hosts) ) = flags_host {
564563 Some ( hosts)
565- } else if let Some ( file_host) = host {
564+ } else if let Some ( file_host) = build_host_toml {
566565 Some ( file_host. iter ( ) . map ( |h| TargetSelection :: from_user ( h) ) . collect ( ) )
567566 } else {
568567 None
569568 } ;
570569 let target = if let Some ( TargetSelectionList ( targets) ) = flags_target {
571570 Some ( targets)
572- } else if let Some ( file_target) = target {
571+ } else if let Some ( file_target) = build_target_toml {
573572 Some ( file_target. iter ( ) . map ( |h| TargetSelection :: from_user ( h) ) . collect ( ) )
574573 } else {
575574 None
576575 } ;
577576
578- if let Some ( rustc) = & rustc {
577+ if let Some ( rustc) = & build_rustc_toml {
579578 if !flags_skip_stage0_validation {
580579 check_stage0_version ( & rustc, "rustc" , & config. src , config. exec_ctx ( ) ) ;
581580 }
582581 }
583- if let Some ( cargo) = & cargo {
582+ if let Some ( cargo) = & build_cargo_toml {
584583 if !flags_skip_stage0_validation {
585584 check_stage0_version ( & cargo, "cargo" , & config. src , config. exec_ctx ( ) ) ;
586585 }
@@ -590,10 +589,10 @@ impl Config {
590589 // TOML.
591590 config
592591 . exec_ctx
593- . set_verbosity ( cmp:: max ( build_verbose . unwrap_or_default ( ) as u8 , flags_verbose) ) ;
592+ . set_verbosity ( cmp:: max ( build_verbose_toml . unwrap_or_default ( ) as u8 , flags_verbose) ) ;
594593
595594 let mut paths: Vec < PathBuf > = flags_skip. into_iter ( ) . chain ( flags_exclude) . collect ( ) ;
596- if let Some ( exclude) = exclude {
595+ if let Some ( exclude) = build_exclude_toml {
597596 paths. extend ( exclude) ;
598597 }
599598
@@ -657,8 +656,8 @@ impl Config {
657656 "config.skip" = ?config. skip,
658657 ) ;
659658
660- config. jobs = Some ( threads_from_config ( jobs . unwrap_or ( 0 ) ) ) ;
661- if let Some ( build) = build {
659+ config. jobs = Some ( threads_from_config ( build_jobs_toml . unwrap_or ( 0 ) ) ) ;
660+ if let Some ( build) = build_build_toml {
662661 config. host_target = TargetSelection :: from_user ( & build) ;
663662 }
664663
@@ -670,18 +669,13 @@ impl Config {
670669 config. out = absolute ( & config. out ) . expect ( "can't make empty path absolute" ) ;
671670 }
672671
673- if cargo_clippy . is_some ( ) && rustc . is_none ( ) {
672+ if build_cargo_clippy_toml . is_some ( ) && build_rustc_toml . is_none ( ) {
674673 println ! (
675674 "WARNING: Using `build.cargo-clippy` without `build.rustc` usually fails due to toolchain conflict."
676675 ) ;
677676 }
678677
679- config. patch_binaries_for_nix = patch_binaries_for_nix;
680- config. bootstrap_cache_path = bootstrap_cache_path;
681- config. llvm_assertions =
682- toml. llvm . as_ref ( ) . is_some_and ( |llvm| llvm. assertions . unwrap_or ( false ) ) ;
683-
684- config. initial_rustc = if let Some ( rustc) = rustc {
678+ config. initial_rustc = if let Some ( rustc) = build_rustc_toml {
685679 rustc
686680 } else {
687681 let dwn_ctx = DownloadContext :: from ( & config) ;
@@ -703,9 +697,9 @@ impl Config {
703697 . trim( )
704698 ) ) ;
705699
706- config. initial_cargo_clippy = cargo_clippy ;
700+ config. initial_cargo_clippy = build_cargo_clippy_toml ;
707701
708- config. initial_cargo = if let Some ( cargo) = cargo {
702+ config. initial_cargo = if let Some ( cargo) = build_cargo_toml {
709703 cargo
710704 } else {
711705 let dwn_ctx = DownloadContext :: from ( & config) ;
@@ -729,31 +723,33 @@ impl Config {
729723 config. hosts . clone ( )
730724 } ;
731725
732- config. nodejs = nodejs. map ( PathBuf :: from) ;
733- config. npm = npm. map ( PathBuf :: from) ;
734- config. gdb = gdb. map ( PathBuf :: from) ;
735- config. lldb = lldb. map ( PathBuf :: from) ;
736- config. python = python. map ( PathBuf :: from) ;
737- config. reuse = reuse. map ( PathBuf :: from) ;
738- config. submodules = submodules;
739- config. android_ndk = android_ndk;
740- set ( & mut config. low_priority , low_priority) ;
741- set ( & mut config. compiler_docs , compiler_docs) ;
742- set ( & mut config. library_docs_private_items , library_docs_private_items) ;
743- set ( & mut config. docs_minification , docs_minification) ;
744- set ( & mut config. docs , docs) ;
745- set ( & mut config. locked_deps , locked_deps) ;
746- set ( & mut config. full_bootstrap , full_bootstrap) ;
747- set ( & mut config. extended , extended) ;
748- config. tools = tools;
749- set ( & mut config. tool , tool) ;
750- set ( & mut config. sanitizers , sanitizers) ;
751- set ( & mut config. profiler , profiler) ;
752- set ( & mut config. cargo_native_static , cargo_native_static) ;
753- set ( & mut config. configure_args , configure_args) ;
754- set ( & mut config. local_rebuild , local_rebuild) ;
755- set ( & mut config. print_step_timings , print_step_timings) ;
756- set ( & mut config. print_step_rusage , print_step_rusage) ;
726+ config. nodejs = build_nodejs_toml. map ( PathBuf :: from) ;
727+ config. npm = build_npm_toml. map ( PathBuf :: from) ;
728+ config. gdb = build_gdb_toml. map ( PathBuf :: from) ;
729+ config. lldb = build_lldb_toml. map ( PathBuf :: from) ;
730+ config. python = build_python_toml. map ( PathBuf :: from) ;
731+ config. reuse = build_reuse_toml. map ( PathBuf :: from) ;
732+ config. submodules = build_submodules_toml;
733+ config. android_ndk = build_android_ndk_toml;
734+ config. bootstrap_cache_path = build_bootstrap_cache_path_toml;
735+ set ( & mut config. low_priority , build_low_priority_toml) ;
736+ set ( & mut config. compiler_docs , build_compiler_docs_toml) ;
737+ set ( & mut config. library_docs_private_items , build_library_docs_private_items_toml) ;
738+ set ( & mut config. docs_minification , build_docs_minification_toml) ;
739+ set ( & mut config. docs , build_docs_toml) ;
740+ set ( & mut config. locked_deps , build_locked_deps_toml) ;
741+ set ( & mut config. full_bootstrap , build_full_bootstrap_toml) ;
742+ set ( & mut config. extended , build_extended_toml) ;
743+ config. tools = build_tools_toml;
744+ set ( & mut config. tool , build_tool_toml) ;
745+ set ( & mut config. sanitizers , build_sanitizers_toml) ;
746+ set ( & mut config. profiler , build_profiler_toml) ;
747+ set ( & mut config. cargo_native_static , build_cargo_native_static_toml) ;
748+ set ( & mut config. configure_args , build_configure_args_toml) ;
749+ set ( & mut config. local_rebuild , build_local_rebuild_toml) ;
750+ set ( & mut config. print_step_timings , build_print_step_timings_toml) ;
751+ set ( & mut config. print_step_rusage , build_print_step_rusage_toml) ;
752+ config. patch_binaries_for_nix = build_patch_binaries_for_nix_toml;
757753
758754 // Verbose flag is a good default for `rust.verbose-tests`.
759755 config. verbose_tests = config. is_verbose ( ) ;
@@ -818,7 +814,7 @@ impl Config {
818814 config. in_tree_llvm_info = config. git_info ( false , & config. src . join ( "src/llvm-project" ) ) ;
819815 config. in_tree_gcc_info = config. git_info ( false , & config. src . join ( "src/gcc" ) ) ;
820816
821- config. vendor = vendor . unwrap_or (
817+ config. vendor = build_vendor_toml . unwrap_or (
822818 config. rust_info . is_from_tarball ( )
823819 && config. src . join ( "vendor" ) . exists ( )
824820 && config. src . join ( ".cargo/config.toml" ) . exists ( ) ,
@@ -1113,7 +1109,7 @@ impl Config {
11131109 rust_debuginfo_level_tests_toml. unwrap_or ( DebuginfoLevel :: None ) ;
11141110
11151111 config. reproducible_artifacts = flags_reproducible_artifact;
1116- config. description = description ;
1112+ config. description = build_description_toml ;
11171113
11181114 // We need to override `rust.channel` if it's manually specified when using the CI rustc.
11191115 // This is because if the compiler uses a different channel than the one specified in bootstrap.toml,
@@ -1247,7 +1243,7 @@ impl Config {
12471243 None => GccCiMode :: default ( ) ,
12481244 } ;
12491245
1250- match ccache {
1246+ match build_ccache_toml {
12511247 Some ( StringOrBool :: String ( ref s) ) => config. ccache = Some ( s. to_string ( ) ) ,
12521248 Some ( StringOrBool :: Bool ( true ) ) => {
12531249 config. ccache = Some ( "ccache" . to_string ( ) ) ;
@@ -1292,7 +1288,7 @@ impl Config {
12921288 config. rust_info . is_managed_git_subrepository ( ) || config. rust_info . is_from_tarball ( )
12931289 } ) ;
12941290
1295- config. initial_rustfmt = if let Some ( r) = rustfmt {
1291+ config. initial_rustfmt = if let Some ( r) = build_rustfmt_toml {
12961292 Some ( r)
12971293 } else {
12981294 let dwn_ctx = DownloadContext :: from ( & config) ;
@@ -1313,41 +1309,40 @@ impl Config {
13131309 }
13141310
13151311 config. optimized_compiler_builtins =
1316- optimized_compiler_builtins. unwrap_or ( config. channel != "dev" ) ;
1317-
1318- config. compiletest_diff_tool = compiletest_diff_tool;
1319-
1320- config. compiletest_allow_stage0 = compiletest_allow_stage0. unwrap_or ( false ) ;
1321- config. compiletest_use_stage0_libtest = compiletest_use_stage0_libtest. unwrap_or ( true ) ;
1322-
1323- config. tidy_extra_checks = tidy_extra_checks;
1312+ build_optimized_compiler_builtins_toml. unwrap_or ( config. channel != "dev" ) ;
1313+ config. compiletest_diff_tool = build_compiletest_diff_tool_toml;
1314+ config. compiletest_use_stage0_libtest =
1315+ build_compiletest_use_stage0_libtest_toml. unwrap_or ( true ) ;
1316+ config. tidy_extra_checks = build_tidy_extra_checks_toml;
13241317
13251318 let download_rustc = config. download_rustc_commit . is_some ( ) ;
13261319 config. explicit_stage_from_cli = flags_stage. is_some ( ) ;
1327- config. explicit_stage_from_config = test_stage . is_some ( )
1328- || build_stage . is_some ( )
1329- || doc_stage . is_some ( )
1330- || dist_stage . is_some ( )
1331- || install_stage . is_some ( )
1332- || check_stage . is_some ( )
1333- || bench_stage . is_some ( ) ;
1320+ config. explicit_stage_from_config = build_test_stage_toml . is_some ( )
1321+ || build_build_stage_toml . is_some ( )
1322+ || build_doc_stage_toml . is_some ( )
1323+ || build_dist_stage_toml . is_some ( )
1324+ || build_install_stage_toml . is_some ( )
1325+ || build_check_stage_toml . is_some ( )
1326+ || build_bench_stage_toml . is_some ( ) ;
13341327
13351328 config. stage = match config. cmd {
1336- Subcommand :: Check { .. } => flags_stage. or ( check_stage) . unwrap_or ( 1 ) ,
1337- Subcommand :: Clippy { .. } | Subcommand :: Fix => flags_stage. or ( check_stage) . unwrap_or ( 1 ) ,
1329+ Subcommand :: Check { .. } => flags_stage. or ( build_check_stage_toml) . unwrap_or ( 1 ) ,
1330+ Subcommand :: Clippy { .. } | Subcommand :: Fix => {
1331+ flags_stage. or ( build_check_stage_toml) . unwrap_or ( 1 )
1332+ }
13381333 // `download-rustc` only has a speed-up for stage2 builds. Default to stage2 unless explicitly overridden.
13391334 Subcommand :: Doc { .. } => {
1340- flags_stage. or ( doc_stage ) . unwrap_or ( if download_rustc { 2 } else { 1 } )
1335+ flags_stage. or ( build_doc_stage_toml ) . unwrap_or ( if download_rustc { 2 } else { 1 } )
13411336 }
13421337 Subcommand :: Build => {
1343- flags_stage. or ( build_stage ) . unwrap_or ( if download_rustc { 2 } else { 1 } )
1338+ flags_stage. or ( build_build_stage_toml ) . unwrap_or ( if download_rustc { 2 } else { 1 } )
13441339 }
13451340 Subcommand :: Test { .. } | Subcommand :: Miri { .. } => {
1346- flags_stage. or ( test_stage ) . unwrap_or ( if download_rustc { 2 } else { 1 } )
1341+ flags_stage. or ( build_test_stage_toml ) . unwrap_or ( if download_rustc { 2 } else { 1 } )
13471342 }
1348- Subcommand :: Bench { .. } => flags_stage. or ( bench_stage ) . unwrap_or ( 2 ) ,
1349- Subcommand :: Dist => flags_stage. or ( dist_stage ) . unwrap_or ( 2 ) ,
1350- Subcommand :: Install => flags_stage. or ( install_stage ) . unwrap_or ( 2 ) ,
1343+ Subcommand :: Bench { .. } => flags_stage. or ( build_bench_stage_toml ) . unwrap_or ( 2 ) ,
1344+ Subcommand :: Dist => flags_stage. or ( build_dist_stage_toml ) . unwrap_or ( 2 ) ,
1345+ Subcommand :: Install => flags_stage. or ( build_install_stage_toml ) . unwrap_or ( 2 ) ,
13511346 Subcommand :: Perf { .. } => flags_stage. unwrap_or ( 1 ) ,
13521347 // These are all bootstrap tools, which don't depend on the compiler.
13531348 // The stage we pass shouldn't matter, but use 0 just in case.
0 commit comments