@@ -509,7 +509,7 @@ impl Config {
509509        // TOML values by accident instead, because flags have higher priority. 
510510        let  Build  { 
511511            description :  build_description, 
512-             build :  mut   build_build, 
512+             build :  build_build, 
513513            host :  build_host, 
514514            target :  build_target, 
515515            build_dir :  build_build_dir, 
@@ -556,7 +556,7 @@ impl Config {
556556            metrics :  _, 
557557            android_ndk :  build_android_ndk, 
558558            optimized_compiler_builtins :  build_optimized_compiler_builtins, 
559-             jobs :  mut   build_jobs, 
559+             jobs :  build_jobs, 
560560            compiletest_diff_tool :  build_compiletest_diff_tool, 
561561            compiletest_use_stage0_libtest :  build_compiletest_use_stage0_libtest, 
562562            tidy_extra_checks :  build_tidy_extra_checks, 
@@ -811,21 +811,59 @@ impl Config {
811811        let  rust_codegen_backends = rust_codegen_backends_
812812            . map ( |backends| parse_codegen_backends ( backends,  "rust" ) ) 
813813            . 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 ; 
819814        let  deny_warnings = match  flags_warnings { 
820815            Warnings :: Deny  => true , 
821816            Warnings :: Warn  => false , 
822817            Warnings :: Default  => rust_deny_warnings. unwrap_or ( true ) , 
823818        } ; 
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 ; 
825864        let  llvm_link_shared = Cell :: default ( ) ; 
826865        let  mut  llvm_from_ci = false ; 
827866        let  mut  lld_enabled = false ; 
828-         let  mut  host_target = get_host_target ( ) ; 
829867        let  mut  channel = "dev" . to_string ( ) ; 
830868        let  mut  out = PathBuf :: from ( "build" ) ; 
831869        let  mut  rust_info = GitInfo :: Absent ; 
@@ -840,9 +878,6 @@ impl Config {
840878            build_cargo = build_cargo. take ( ) . or ( std:: env:: var_os ( "CARGO" ) . map ( |p| p. into ( ) ) ) ; 
841879        } 
842880
843-         build_jobs = flags_jobs. or ( build_jobs) ; 
844-         build_build = flags_build. or ( build_build) ; 
845- 
846881        let  build_dir_ = flags_build_dir. or ( build_build_dir. map ( PathBuf :: from) ) ; 
847882        let  host_ = if  let  Some ( TargetSelectionList ( hosts) )  = flags_host { 
848883            Some ( hosts) 
@@ -886,6 +921,13 @@ impl Config {
886921            . to_path_buf ( ) ; 
887922        } 
888923
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+         ) ; 
889931        let  skip = paths_
890932            . into_iter ( ) 
891933            . map ( |p| { 
@@ -900,19 +942,6 @@ impl Config {
900942            } ) 
901943            . collect ( ) ; 
902944
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- 
916945        set ( & mut  out,  build_dir_) ; 
917946        // NOTE: Bootstrap spawns various commands with different working directories. 
918947        // To avoid writing to random places on the file system, `config.out` needs to be an absolute path. 
@@ -1002,10 +1031,6 @@ impl Config {
10021031            hosts. clone ( ) 
10031032        } ; 
10041033
1005-         submodules = build_submodules; 
1006- 
1007-         llvm_assertions = llvm_assertions_. unwrap_or ( false ) ; 
1008- 
10091034        let  file_content = t ! ( fs:: read_to_string( src. join( "src/ci/channel" ) ) ) ; 
10101035        let  ci_channel = file_content. trim_end ( ) ; 
10111036
@@ -1160,19 +1185,6 @@ impl Config {
11601185            } 
11611186        } 
11621187
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- 
11761188        // We make `x86_64-unknown-linux-gnu` use the self-contained linker by default, so we will 
11771189        // build our internal lld and use it as the default linker, by setting the `rust.lld` config 
11781190        // to true by default: 
@@ -1198,8 +1210,6 @@ impl Config {
11981210            set ( & mut  lld_enabled,  rust_lld_enabled) ; 
11991211        } 
12001212
1201-         let  description = build_description; 
1202- 
12031213        // We need to override `rust.channel` if it's manually specified when using the CI rustc. 
12041214        // This is because if the compiler uses a different channel than the one specified in bootstrap.toml, 
12051215        // tests may fail due to using a different channel than the one used by the compiler during tests. 
@@ -1298,22 +1308,6 @@ impl Config {
12981308            llvm_link_shared. set ( Some ( true ) ) ; 
12991309        } 
13001310
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- 
13171311        if  llvm_from_ci { 
13181312            let  triple = & host_target. triple ; 
13191313            let  dwn_ctx = DownloadContext :: new ( 
@@ -1403,18 +1397,8 @@ impl Config {
14031397
14041398        let  optimized_compiler_builtins =
14051399            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; 
14091400
14101401        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 ( ) ; 
14181402
14191403        let  stage = match  cmd { 
14201404            Subcommand :: Check  {  .. }  => flags_stage. or ( build_check_stage) . unwrap_or ( 1 ) , 
0 commit comments