@@ -495,6 +495,29 @@ impl Config {
495
495
let patch_binaries_for_nix;
496
496
let stage;
497
497
let cmd;
498
+ let llvm_optimize = true ;
499
+ let ninja_in_file = true ;
500
+ let llvm_static_stdcpp = false ;
501
+ let llvm_libzstd = false ;
502
+ let backtrace = true ;
503
+ let rust_optimize = RustOptimize :: Bool ( true ) ;
504
+ let rust_optimize_tests = true ;
505
+ let rust_randomize_layout = false ;
506
+ let docs = true ;
507
+ let docs_minification = true ;
508
+ let rust_rpath = true ;
509
+ let rust_strip = false ;
510
+ let codegen_tests = true ;
511
+ let rust_dist_src = true ;
512
+ let rust_codegen_backends = vec ! [ CodegenBackendKind :: Llvm ] ;
513
+ let deny_warnings = true ;
514
+ let bindir = "bin" . to_string ( ) ;
515
+ let dist_include_mingw_linker = true ;
516
+ let dist_compression_profile = "fast" . to_string ( ) ;
517
+
518
+ // This is needed by codegen_ssa on macOS to ship `llvm-objcopy` aliased to
519
+ // `rust-objcopy` to workaround bad `strip`s on macOS.
520
+ let llvm_tools_enabled = true ;
498
521
499
522
// First initialize the bare minimum that we need for further operation - source directory
500
523
// and execution context.
@@ -1238,8 +1261,8 @@ impl Config {
1238
1261
set ( & mut config. low_priority , build_low_priority_toml) ;
1239
1262
set ( & mut config. compiler_docs , build_compiler_docs_toml) ;
1240
1263
set ( & mut config. library_docs_private_items , build_library_docs_private_items_toml) ;
1241
- set ( & mut config. docs_minification , build_docs_minification_toml) ;
1242
- set ( & mut config. docs , build_docs_toml) ;
1264
+ config. docs_minification = build_docs_minification_toml. unwrap_or ( docs_minification ) ;
1265
+ config. docs = build_docs_toml. unwrap_or ( docs ) ;
1243
1266
set ( & mut config. locked_deps , build_locked_deps_toml) ;
1244
1267
set ( & mut config. full_bootstrap , build_full_bootstrap_toml) ;
1245
1268
set ( & mut config. extended , build_extended_toml) ;
@@ -1259,7 +1282,7 @@ impl Config {
1259
1282
config. sysconfdir = install_sysconfdir_toml. map ( PathBuf :: from) ;
1260
1283
config. datadir = install_datadir_toml. map ( PathBuf :: from) ;
1261
1284
config. docdir = install_docdir_toml. map ( PathBuf :: from) ;
1262
- set ( & mut config. bindir , install_bindir_toml . map ( PathBuf :: from) ) ;
1285
+ config. bindir = PathBuf :: from ( install_bindir_toml . unwrap_or ( bindir ) ) ;
1263
1286
config. libdir = install_libdir_toml. map ( PathBuf :: from) ;
1264
1287
config. mandir = install_mandir_toml. map ( PathBuf :: from) ;
1265
1288
@@ -1283,39 +1306,38 @@ impl Config {
1283
1306
1284
1307
// rust.* settings
1285
1308
config. rust_new_symbol_mangling = rust_new_symbol_mangling_toml;
1286
- set ( & mut config. rust_optimize_tests , rust_optimize_tests_toml) ;
1287
- set ( & mut config. codegen_tests , rust_codegen_tests_toml) ;
1288
- set ( & mut config. rust_rpath , rust_rpath_toml) ;
1289
- set ( & mut config. rust_strip , rust_strip_toml) ;
1309
+ config. rust_optimize_tests = rust_optimize_tests_toml. unwrap_or ( rust_optimize_tests ) ;
1310
+ config. codegen_tests = rust_codegen_tests_toml. unwrap_or ( codegen_tests ) ;
1311
+ config. rust_rpath = rust_rpath_toml. unwrap_or ( rust_rpath ) ;
1312
+ config. rust_strip = rust_strip_toml. unwrap_or ( rust_strip ) ;
1290
1313
set ( & mut config. rust_frame_pointers , rust_frame_pointers_toml) ;
1291
1314
config. rust_stack_protector = rust_stack_protector_toml;
1292
1315
set ( & mut config. jemalloc , rust_jemalloc_toml) ;
1293
1316
set ( & mut config. test_compare_mode , rust_test_compare_mode_toml) ;
1294
- set ( & mut config. backtrace , rust_backtrace_toml) ;
1295
- set ( & mut config. rust_dist_src , rust_dist_src_toml) ;
1317
+ config. backtrace = rust_backtrace_toml. unwrap_or ( backtrace) ;
1318
+ config. rust_dist_src =
1319
+ rust_dist_src_toml. or ( dist_src_tarball_toml) . unwrap_or ( rust_dist_src) ;
1296
1320
set ( & mut config. verbose_tests , rust_verbose_tests_toml) ;
1297
1321
1298
1322
if let Some ( true ) = rust_incremental_toml {
1299
1323
config. incremental = true ;
1300
1324
}
1301
1325
1302
1326
set ( & mut config. llvm_bitcode_linker_enabled , rust_llvm_bitcode_linker_toml) ;
1303
- config. rust_randomize_layout = rust_randomize_layout_toml. unwrap_or_default ( ) ;
1304
- config. llvm_tools_enabled = rust_llvm_tools_toml. unwrap_or ( true ) ;
1327
+ config. rust_randomize_layout = rust_randomize_layout_toml. unwrap_or ( rust_randomize_layout ) ;
1328
+ config. llvm_tools_enabled = rust_llvm_tools_toml. unwrap_or ( llvm_tools_enabled ) ;
1305
1329
config. llvm_enzyme = channel == "dev" || channel == "nightly" ;
1306
1330
config. rustc_default_linker = rust_default_linker_toml;
1307
1331
config. musl_root = rust_musl_root_toml. map ( PathBuf :: from) ;
1308
1332
config. save_toolstates = rust_save_toolstates_toml. map ( PathBuf :: from) ;
1309
1333
1310
1334
// Warnings and debug options
1311
- set (
1312
- & mut config. deny_warnings ,
1313
- match flags_warnings {
1314
- Warnings :: Deny => Some ( true ) ,
1315
- Warnings :: Warn => Some ( false ) ,
1316
- Warnings :: Default => rust_deny_warnings_toml,
1317
- } ,
1318
- ) ;
1335
+ config. deny_warnings = match flags_warnings {
1336
+ Warnings :: Deny => Some ( true ) ,
1337
+ Warnings :: Warn => Some ( false ) ,
1338
+ Warnings :: Default => rust_deny_warnings_toml,
1339
+ }
1340
+ . unwrap_or ( deny_warnings) ;
1319
1341
set ( & mut config. backtrace_on_ice , rust_backtrace_on_ice_toml) ;
1320
1342
set ( & mut config. rust_verify_llvm_ir , rust_verify_llvm_ir_toml) ;
1321
1343
config. rust_thin_lto_import_instr_limit = rust_thin_lto_import_instr_limit_toml;
@@ -1324,15 +1346,14 @@ impl Config {
1324
1346
set ( & mut config. ehcont_guard , rust_ehcont_guard_toml) ;
1325
1347
config. llvm_libunwind_default = rust_llvm_libunwind_toml
1326
1348
. map ( |v| v. parse ( ) . expect ( "failed to parse rust.llvm-libunwind" ) ) ;
1327
- set (
1328
- & mut config. rust_codegen_backends ,
1329
- rust_codegen_backends_toml. map ( |b| parse_codegen_backends ( b, "rust" ) ) ,
1330
- ) ;
1349
+ config. rust_codegen_backends = rust_codegen_backends_toml
1350
+ . map ( |b| parse_codegen_backends ( b, "rust" ) )
1351
+ . unwrap_or ( rust_codegen_backends) ;
1331
1352
1332
1353
config. rust_lto =
1333
1354
rust_lto_toml. as_deref ( ) . map ( |v| RustcLto :: from_str ( v) . unwrap ( ) ) . unwrap_or_default ( ) ;
1334
1355
config. rust_validate_mir_opts = rust_validate_mir_opts_toml;
1335
- config. rust_optimize = rust_optimize_toml. unwrap_or ( RustOptimize :: Bool ( true ) ) ;
1356
+ config. rust_optimize = rust_optimize_toml. unwrap_or ( rust_optimize ) ;
1336
1357
config. rust_codegen_units = rust_codegen_units_toml. map ( threads_from_config) ;
1337
1358
config. rust_codegen_units_std = rust_codegen_units_std_toml. map ( threads_from_config) ;
1338
1359
config. rust_std_features = rust_std_features_toml
@@ -1358,12 +1379,12 @@ impl Config {
1358
1379
rust_debuginfo_level_tests_toml. unwrap_or ( DebuginfoLevel :: None ) ;
1359
1380
1360
1381
// LLVM Configuration
1361
- set ( & mut config. ninja_in_file , llvm_ninja_toml) ;
1362
- set ( & mut config. llvm_optimize , llvm_optimize_toml) ;
1382
+ config. ninja_in_file = llvm_ninja_toml. unwrap_or ( ninja_in_file ) ;
1383
+ config. llvm_optimize = llvm_optimize_toml. unwrap_or ( llvm_optimize ) ;
1363
1384
set ( & mut llvm_thin_lto, llvm_thin_lto_toml) ;
1364
1385
set ( & mut config. llvm_release_debuginfo , llvm_release_debuginfo_toml) ;
1365
- set ( & mut config. llvm_static_stdcpp , llvm_static_libstdcpp_toml) ;
1366
- set ( & mut config. llvm_libzstd , llvm_libzstd_toml) ;
1386
+ config. llvm_static_stdcpp = llvm_static_libstdcpp_toml. unwrap_or ( llvm_static_stdcpp ) ;
1387
+ config. llvm_libzstd = llvm_libzstd_toml. unwrap_or ( llvm_libzstd ) ;
1367
1388
1368
1389
if let Some ( v) = llvm_link_shared_toml {
1369
1390
config. llvm_link_shared . set ( Some ( v) ) ;
@@ -1414,9 +1435,10 @@ impl Config {
1414
1435
config. dist_sign_folder = dist_sign_folder_toml. map ( PathBuf :: from) ;
1415
1436
config. dist_upload_addr = dist_upload_addr_toml;
1416
1437
config. dist_compression_formats = dist_compression_formats_toml;
1417
- set ( & mut config. dist_compression_profile , dist_compression_profile_toml) ;
1418
- set ( & mut config. rust_dist_src , dist_src_tarball_toml) ;
1419
- set ( & mut config. dist_include_mingw_linker , dist_include_mingw_linker_toml) ;
1438
+ config. dist_compression_profile =
1439
+ dist_compression_profile_toml. unwrap_or ( dist_compression_profile) ;
1440
+ config. dist_include_mingw_linker =
1441
+ dist_include_mingw_linker_toml. unwrap_or ( dist_include_mingw_linker) ;
1420
1442
1421
1443
// Default enable dist.vendor for managed git/tarball sources
1422
1444
config. dist_vendor = dist_vendor_toml. unwrap_or_else ( || {
0 commit comments