@@ -337,46 +337,8 @@ impl Config {
337
337
span ! ( target: "CONFIG_HANDLING" , tracing:: Level :: TRACE , "constructing default config" ) ;
338
338
339
339
Config {
340
- bypass_bootstrap_lock : false ,
341
- llvm_optimize : true ,
342
- ninja_in_file : true ,
343
- llvm_static_stdcpp : false ,
344
- llvm_libzstd : false ,
345
- backtrace : true ,
346
- rust_optimize : RustOptimize :: Bool ( true ) ,
347
- rust_optimize_tests : true ,
348
- rust_randomize_layout : false ,
349
- submodules : None ,
350
- docs : true ,
351
- docs_minification : true ,
352
- rust_rpath : true ,
353
- rust_strip : false ,
354
- channel : "dev" . to_string ( ) ,
355
- codegen_tests : true ,
356
- rust_dist_src : true ,
357
- rust_codegen_backends : vec ! [ CodegenBackendKind :: Llvm ] ,
358
- deny_warnings : true ,
359
- bindir : "bin" . into ( ) ,
360
- dist_include_mingw_linker : true ,
361
- dist_compression_profile : "fast" . into ( ) ,
362
-
363
340
stdout_is_tty : std:: io:: stdout ( ) . is_terminal ( ) ,
364
341
stderr_is_tty : std:: io:: stderr ( ) . is_terminal ( ) ,
365
-
366
- // set by build.rs
367
- host_target : get_host_target ( ) ,
368
-
369
- src : {
370
- let manifest_dir = PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) ) ;
371
- // Undo `src/bootstrap`
372
- manifest_dir. parent ( ) . unwrap ( ) . parent ( ) . unwrap ( ) . to_owned ( )
373
- } ,
374
- out : PathBuf :: from ( "build" ) ,
375
-
376
- // This is needed by codegen_ssa on macOS to ship `llvm-objcopy` aliased to
377
- // `rust-objcopy` to workaround bad `strip`s on macOS.
378
- llvm_tools_enabled : true ,
379
-
380
342
..Default :: default ( )
381
343
}
382
344
}
@@ -464,6 +426,7 @@ impl Config {
464
426
) ;
465
427
466
428
let mut out = PathBuf :: from ( "build" ) ;
429
+ // set by build.rs
467
430
let mut host_target = get_host_target ( ) ;
468
431
let initial_rustc;
469
432
let initial_sysroot;
@@ -521,18 +484,16 @@ impl Config {
521
484
522
485
// First initialize the bare minimum that we need for further operation - source directory
523
486
// and execution context.
524
- let mut config = Config :: default_opts ( ) ;
525
- let exec_ctx = ExecutionContext :: new ( flags_verbose, flags_cmd. fail_fast ( ) ) ;
487
+ let mut exec_ctx = ExecutionContext :: new ( flags_verbose, flags_cmd. fail_fast ( ) ) ;
526
488
527
489
if let Some ( src_) = compute_src_directory ( flags_src, & exec_ctx) {
528
490
src = src_;
529
491
}
530
492
531
493
// Now load the TOML config, as soon as possible
532
494
let ( mut toml, toml_path) = load_toml_config ( & src, flags_config, & get_toml) ;
533
- config. config = toml_path. clone ( ) ;
534
495
535
- postprocess_toml ( & mut toml, & src, toml_path, & exec_ctx, & flags_set, & get_toml) ;
496
+ postprocess_toml ( & mut toml, & src, toml_path. clone ( ) , & exec_ctx, & flags_set, & get_toml) ;
536
497
537
498
// Now override TOML values with flags, to make sure that we won't later override flags with
538
499
// TOML values by accident instead, because flags have higher priority.
@@ -748,8 +709,7 @@ impl Config {
748
709
749
710
// Prefer CLI verbosity flags if set (`flags_verbose` > 0), otherwise take the value from
750
711
// TOML.
751
- config
752
- . exec_ctx
712
+ exec_ctx
753
713
. set_verbosity ( cmp:: max ( build_verbose_toml. unwrap_or_default ( ) as u8 , flags_verbose) ) ;
754
714
755
715
let mut paths: Vec < PathBuf > = flags_skip. into_iter ( ) . chain ( flags_exclude) . collect ( ) ;
@@ -914,7 +874,7 @@ impl Config {
914
874
command( & initial_rustc)
915
875
. args( [ "--print" , "sysroot" ] )
916
876
. run_in_dry_run( )
917
- . run_capture_stdout( & config )
877
+ . run_capture_stdout( & exec_ctx )
918
878
. stdout( )
919
879
. trim( )
920
880
) ) ;
@@ -1136,13 +1096,6 @@ impl Config {
1136
1096
_ => { }
1137
1097
}
1138
1098
1139
- if config. compile_time_deps && !matches ! ( cmd, Subcommand :: Check { .. } ) {
1140
- eprintln ! (
1141
- "WARNING: Can't use --compile-time-deps with any subcommand other than check."
1142
- ) ;
1143
- exit ! ( 1 ) ;
1144
- }
1145
-
1146
1099
// CI should always run stage 2 builds, unless it specifically states otherwise
1147
1100
#[ cfg( not( test) ) ]
1148
1101
if flags_stage. is_none ( ) && is_running_on_ci {
@@ -1172,12 +1125,23 @@ impl Config {
1172
1125
}
1173
1126
}
1174
1127
1128
+ let mut config = Config :: default_opts ( ) ;
1129
+ config. config = toml_path. clone ( ) ;
1130
+
1175
1131
// Flag-based core settings
1176
1132
config. paths = flags_paths;
1177
1133
config. include_default_paths = flags_include_default_paths;
1178
1134
config. rustc_error_format = flags_rustc_error_format;
1179
1135
config. json_output = flags_json_output;
1180
1136
config. compile_time_deps = flags_compile_time_deps;
1137
+
1138
+ if config. compile_time_deps && !matches ! ( cmd, Subcommand :: Check { .. } ) {
1139
+ eprintln ! (
1140
+ "WARNING: Can't use --compile-time-deps with any subcommand other than check."
1141
+ ) ;
1142
+ exit ! ( 1 ) ;
1143
+ }
1144
+
1181
1145
config. on_fail = flags_on_fail;
1182
1146
config. incremental = flags_incremental;
1183
1147
config. dump_bootstrap_shims = flags_dump_bootstrap_shims;
0 commit comments