Skip to content

Commit ec41761

Browse files
committedDec 10, 2023
Auto merge of #118703 - Kobzol:bootstrap-config-unused, r=onur-ozkan
Remove unused bootstrap config option I tried to destructure a few of the TOML config structs to find any unused fields. I found that `Rust::run_dysmutil` field is unused. This PR uses destructuring of the `Rust` struct, to find similar unused fields in the future, and also removes the unused field. I also found one more unused field (`Dist::gpg_password_file`), it doesn't seem to be used anywhere. If you like this PR, I'll send another one that uses destructuring for all interesting TOML structs and removes that unused field. r? `@onur-ozkan`
2 parents 7e452c1 + f1c5558 commit ec41761

File tree

3 files changed

+303
-171
lines changed

3 files changed

+303
-171
lines changed
 

‎config.example.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#
3131
# If `change-id` does not match the version that is currently running,
3232
# `x.py` will prompt you to update it and check the related PR for more details.
33-
change-id = 117813
33+
change-id = 118703
3434

3535
# =============================================================================
3636
# Tweaking how LLVM is compiled

‎src/bootstrap/src/core/config/config.rs

Lines changed: 297 additions & 170 deletions
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,6 @@ define_config! {
894894
define_config! {
895895
struct Dist {
896896
sign_folder: Option<String> = "sign-folder",
897-
gpg_password_file: Option<String> = "gpg-password-file",
898897
upload_addr: Option<String> = "upload-addr",
899898
src_tarball: Option<bool> = "src-tarball",
900899
missing_tools: Option<bool> = "missing-tools",
@@ -1070,7 +1069,6 @@ define_config! {
10701069
debuginfo_level_tools: Option<DebuginfoLevel> = "debuginfo-level-tools",
10711070
debuginfo_level_tests: Option<DebuginfoLevel> = "debuginfo-level-tests",
10721071
split_debuginfo: Option<String> = "split-debuginfo",
1073-
run_dsymutil: Option<bool> = "run-dsymutil",
10741072
backtrace: Option<bool> = "backtrace",
10751073
incremental: Option<bool> = "incremental",
10761074
parallel_compiler: Option<bool> = "parallel-compiler",
@@ -1349,20 +1347,64 @@ impl Config {
13491347
config.changelog_seen = toml.changelog_seen;
13501348
config.change_id = toml.change_id;
13511349

1352-
let build = toml.build.unwrap_or_default();
1353-
if let Some(file_build) = build.build {
1350+
let Build {
1351+
build,
1352+
host,
1353+
target,
1354+
build_dir,
1355+
cargo,
1356+
rustc,
1357+
rustfmt,
1358+
docs,
1359+
compiler_docs,
1360+
library_docs_private_items,
1361+
docs_minification,
1362+
submodules,
1363+
gdb,
1364+
nodejs,
1365+
npm,
1366+
python,
1367+
reuse,
1368+
locked_deps,
1369+
vendor,
1370+
full_bootstrap,
1371+
extended,
1372+
tools,
1373+
verbose,
1374+
sanitizers,
1375+
profiler,
1376+
cargo_native_static,
1377+
low_priority,
1378+
configure_args,
1379+
local_rebuild,
1380+
print_step_timings,
1381+
print_step_rusage,
1382+
check_stage,
1383+
doc_stage,
1384+
build_stage,
1385+
test_stage,
1386+
install_stage,
1387+
dist_stage,
1388+
bench_stage,
1389+
patch_binaries_for_nix,
1390+
// This field is only used by bootstrap.py
1391+
metrics: _,
1392+
android_ndk,
1393+
} = toml.build.unwrap_or_default();
1394+
1395+
if let Some(file_build) = build {
13541396
config.build = TargetSelection::from_user(&file_build);
13551397
};
13561398

1357-
set(&mut config.out, flags.build_dir.or_else(|| build.build_dir.map(PathBuf::from)));
1399+
set(&mut config.out, flags.build_dir.or_else(|| build_dir.map(PathBuf::from)));
13581400
// NOTE: Bootstrap spawns various commands with different working directories.
13591401
// To avoid writing to random places on the file system, `config.out` needs to be an absolute path.
13601402
if !config.out.is_absolute() {
13611403
// `canonicalize` requires the path to already exist. Use our vendored copy of `absolute` instead.
13621404
config.out = crate::utils::helpers::absolute(&config.out);
13631405
}
13641406

1365-
config.initial_rustc = if let Some(rustc) = build.rustc {
1407+
config.initial_rustc = if let Some(rustc) = rustc {
13661408
if !flags.skip_stage0_validation {
13671409
config.check_build_rustc_version(&rustc);
13681410
}
@@ -1372,8 +1414,7 @@ impl Config {
13721414
config.out.join(config.build.triple).join("stage0/bin/rustc")
13731415
};
13741416

1375-
config.initial_cargo = build
1376-
.cargo
1417+
config.initial_cargo = cargo
13771418
.map(|cargo| {
13781419
t!(PathBuf::from(cargo).canonicalize(), "`initial_cargo` not found on disk")
13791420
})
@@ -1388,58 +1429,59 @@ impl Config {
13881429

13891430
config.hosts = if let Some(TargetSelectionList(arg_host)) = flags.host {
13901431
arg_host
1391-
} else if let Some(file_host) = build.host {
1432+
} else if let Some(file_host) = host {
13921433
file_host.iter().map(|h| TargetSelection::from_user(h)).collect()
13931434
} else {
13941435
vec![config.build]
13951436
};
13961437
config.targets = if let Some(TargetSelectionList(arg_target)) = flags.target {
13971438
arg_target
1398-
} else if let Some(file_target) = build.target {
1439+
} else if let Some(file_target) = target {
13991440
file_target.iter().map(|h| TargetSelection::from_user(h)).collect()
14001441
} else {
14011442
// If target is *not* configured, then default to the host
14021443
// toolchains.
14031444
config.hosts.clone()
14041445
};
14051446

1406-
config.nodejs = build.nodejs.map(PathBuf::from);
1407-
config.npm = build.npm.map(PathBuf::from);
1408-
config.gdb = build.gdb.map(PathBuf::from);
1409-
config.python = build.python.map(PathBuf::from);
1410-
config.reuse = build.reuse.map(PathBuf::from);
1411-
config.submodules = build.submodules;
1412-
config.android_ndk = build.android_ndk;
1413-
set(&mut config.low_priority, build.low_priority);
1414-
set(&mut config.compiler_docs, build.compiler_docs);
1415-
set(&mut config.library_docs_private_items, build.library_docs_private_items);
1416-
set(&mut config.docs_minification, build.docs_minification);
1417-
set(&mut config.docs, build.docs);
1418-
set(&mut config.locked_deps, build.locked_deps);
1419-
set(&mut config.vendor, build.vendor);
1420-
set(&mut config.full_bootstrap, build.full_bootstrap);
1421-
set(&mut config.extended, build.extended);
1422-
config.tools = build.tools;
1423-
set(&mut config.verbose, build.verbose);
1424-
set(&mut config.sanitizers, build.sanitizers);
1425-
set(&mut config.profiler, build.profiler);
1426-
set(&mut config.cargo_native_static, build.cargo_native_static);
1427-
set(&mut config.configure_args, build.configure_args);
1428-
set(&mut config.local_rebuild, build.local_rebuild);
1429-
set(&mut config.print_step_timings, build.print_step_timings);
1430-
set(&mut config.print_step_rusage, build.print_step_rusage);
1431-
config.patch_binaries_for_nix = build.patch_binaries_for_nix;
1447+
config.nodejs = nodejs.map(PathBuf::from);
1448+
config.npm = npm.map(PathBuf::from);
1449+
config.gdb = gdb.map(PathBuf::from);
1450+
config.python = python.map(PathBuf::from);
1451+
config.reuse = reuse.map(PathBuf::from);
1452+
config.submodules = submodules;
1453+
config.android_ndk = android_ndk;
1454+
set(&mut config.low_priority, low_priority);
1455+
set(&mut config.compiler_docs, compiler_docs);
1456+
set(&mut config.library_docs_private_items, library_docs_private_items);
1457+
set(&mut config.docs_minification, docs_minification);
1458+
set(&mut config.docs, docs);
1459+
set(&mut config.locked_deps, locked_deps);
1460+
set(&mut config.vendor, vendor);
1461+
set(&mut config.full_bootstrap, full_bootstrap);
1462+
set(&mut config.extended, extended);
1463+
config.tools = tools;
1464+
set(&mut config.verbose, verbose);
1465+
set(&mut config.sanitizers, sanitizers);
1466+
set(&mut config.profiler, profiler);
1467+
set(&mut config.cargo_native_static, cargo_native_static);
1468+
set(&mut config.configure_args, configure_args);
1469+
set(&mut config.local_rebuild, local_rebuild);
1470+
set(&mut config.print_step_timings, print_step_timings);
1471+
set(&mut config.print_step_rusage, print_step_rusage);
1472+
config.patch_binaries_for_nix = patch_binaries_for_nix;
14321473

14331474
config.verbose = cmp::max(config.verbose, flags.verbose as usize);
14341475

14351476
if let Some(install) = toml.install {
1436-
config.prefix = install.prefix.map(PathBuf::from);
1437-
config.sysconfdir = install.sysconfdir.map(PathBuf::from);
1438-
config.datadir = install.datadir.map(PathBuf::from);
1439-
config.docdir = install.docdir.map(PathBuf::from);
1440-
set(&mut config.bindir, install.bindir.map(PathBuf::from));
1441-
config.libdir = install.libdir.map(PathBuf::from);
1442-
config.mandir = install.mandir.map(PathBuf::from);
1477+
let Install { prefix, sysconfdir, docdir, bindir, libdir, mandir, datadir } = install;
1478+
config.prefix = prefix.map(PathBuf::from);
1479+
config.sysconfdir = sysconfdir.map(PathBuf::from);
1480+
config.datadir = datadir.map(PathBuf::from);
1481+
config.docdir = docdir.map(PathBuf::from);
1482+
set(&mut config.bindir, bindir.map(PathBuf::from));
1483+
config.libdir = libdir.map(PathBuf::from);
1484+
config.mandir = mandir.map(PathBuf::from);
14431485
}
14441486

14451487
// Store off these values as options because if they're not provided
@@ -1462,9 +1504,63 @@ impl Config {
14621504
let mut omit_git_hash = None;
14631505

14641506
if let Some(rust) = toml.rust {
1465-
set(&mut config.channel, rust.channel);
1466-
1467-
config.download_rustc_commit = config.download_ci_rustc_commit(rust.download_rustc);
1507+
let Rust {
1508+
optimize: optimize_toml,
1509+
debug: debug_toml,
1510+
codegen_units,
1511+
codegen_units_std,
1512+
debug_assertions: debug_assertions_toml,
1513+
debug_assertions_std: debug_assertions_std_toml,
1514+
overflow_checks: overflow_checks_toml,
1515+
overflow_checks_std: overflow_checks_std_toml,
1516+
debug_logging: debug_logging_toml,
1517+
debuginfo_level: debuginfo_level_toml,
1518+
debuginfo_level_rustc: debuginfo_level_rustc_toml,
1519+
debuginfo_level_std: debuginfo_level_std_toml,
1520+
debuginfo_level_tools: debuginfo_level_tools_toml,
1521+
debuginfo_level_tests: debuginfo_level_tests_toml,
1522+
split_debuginfo,
1523+
backtrace,
1524+
incremental,
1525+
parallel_compiler,
1526+
default_linker,
1527+
channel,
1528+
description,
1529+
musl_root,
1530+
rpath,
1531+
verbose_tests,
1532+
optimize_tests,
1533+
codegen_tests,
1534+
omit_git_hash: omit_git_hash_toml,
1535+
dist_src,
1536+
save_toolstates,
1537+
codegen_backends,
1538+
lld,
1539+
llvm_tools,
1540+
deny_warnings,
1541+
backtrace_on_ice,
1542+
verify_llvm_ir,
1543+
thin_lto_import_instr_limit,
1544+
remap_debuginfo,
1545+
jemalloc,
1546+
test_compare_mode,
1547+
llvm_libunwind,
1548+
control_flow_guard,
1549+
ehcont_guard,
1550+
new_symbol_mangling,
1551+
profile_generate,
1552+
profile_use,
1553+
download_rustc,
1554+
lto,
1555+
validate_mir_opts,
1556+
stack_protector,
1557+
strip,
1558+
lld_mode,
1559+
} = rust;
1560+
1561+
set(&mut config.channel, channel);
1562+
1563+
config.download_rustc_commit = config.download_ci_rustc_commit(download_rustc);
14681564
// This list is incomplete, please help by expanding it!
14691565
if config.download_rustc_commit.is_some() {
14701566
// We need the channel used by the downloaded compiler to match the one we set for rustdoc;
@@ -1481,44 +1577,43 @@ impl Config {
14811577
}
14821578
}
14831579

1484-
debug = rust.debug;
1485-
debug_assertions = rust.debug_assertions;
1486-
debug_assertions_std = rust.debug_assertions_std;
1487-
overflow_checks = rust.overflow_checks;
1488-
overflow_checks_std = rust.overflow_checks_std;
1489-
debug_logging = rust.debug_logging;
1490-
debuginfo_level = rust.debuginfo_level;
1491-
debuginfo_level_rustc = rust.debuginfo_level_rustc;
1492-
debuginfo_level_std = rust.debuginfo_level_std;
1493-
debuginfo_level_tools = rust.debuginfo_level_tools;
1494-
debuginfo_level_tests = rust.debuginfo_level_tests;
1495-
1496-
config.rust_split_debuginfo = rust
1497-
.split_debuginfo
1580+
debug = debug_toml;
1581+
debug_assertions = debug_assertions_toml;
1582+
debug_assertions_std = debug_assertions_std_toml;
1583+
overflow_checks = overflow_checks_toml;
1584+
overflow_checks_std = overflow_checks_std_toml;
1585+
debug_logging = debug_logging_toml;
1586+
debuginfo_level = debuginfo_level_toml;
1587+
debuginfo_level_rustc = debuginfo_level_rustc_toml;
1588+
debuginfo_level_std = debuginfo_level_std_toml;
1589+
debuginfo_level_tools = debuginfo_level_tools_toml;
1590+
debuginfo_level_tests = debuginfo_level_tests_toml;
1591+
1592+
config.rust_split_debuginfo = split_debuginfo
14981593
.as_deref()
14991594
.map(SplitDebuginfo::from_str)
15001595
.map(|v| v.expect("invalid value for rust.split_debuginfo"))
15011596
.unwrap_or(SplitDebuginfo::default_for_platform(&config.build.triple));
1502-
optimize = rust.optimize;
1503-
omit_git_hash = rust.omit_git_hash;
1504-
config.rust_new_symbol_mangling = rust.new_symbol_mangling;
1505-
set(&mut config.rust_optimize_tests, rust.optimize_tests);
1506-
set(&mut config.codegen_tests, rust.codegen_tests);
1507-
set(&mut config.rust_rpath, rust.rpath);
1508-
set(&mut config.rust_strip, rust.strip);
1509-
config.rust_stack_protector = rust.stack_protector;
1510-
set(&mut config.jemalloc, rust.jemalloc);
1511-
set(&mut config.test_compare_mode, rust.test_compare_mode);
1512-
set(&mut config.backtrace, rust.backtrace);
1513-
config.description = rust.description;
1514-
set(&mut config.rust_dist_src, rust.dist_src);
1515-
set(&mut config.verbose_tests, rust.verbose_tests);
1597+
optimize = optimize_toml;
1598+
omit_git_hash = omit_git_hash_toml;
1599+
config.rust_new_symbol_mangling = new_symbol_mangling;
1600+
set(&mut config.rust_optimize_tests, optimize_tests);
1601+
set(&mut config.codegen_tests, codegen_tests);
1602+
set(&mut config.rust_rpath, rpath);
1603+
set(&mut config.rust_strip, strip);
1604+
config.rust_stack_protector = stack_protector;
1605+
set(&mut config.jemalloc, jemalloc);
1606+
set(&mut config.test_compare_mode, test_compare_mode);
1607+
set(&mut config.backtrace, backtrace);
1608+
config.description = description;
1609+
set(&mut config.rust_dist_src, dist_src);
1610+
set(&mut config.verbose_tests, verbose_tests);
15161611
// in the case "false" is set explicitly, do not overwrite the command line args
1517-
if let Some(true) = rust.incremental {
1612+
if let Some(true) = incremental {
15181613
config.incremental = true;
15191614
}
1520-
set(&mut config.lld_mode, rust.lld_mode);
1521-
set(&mut config.lld_enabled, rust.lld);
1615+
set(&mut config.lld_mode, lld_mode);
1616+
set(&mut config.lld_enabled, lld);
15221617

15231618
if matches!(config.lld_mode, LldMode::SelfContained)
15241619
&& !config.lld_enabled
@@ -1529,32 +1624,30 @@ impl Config {
15291624
);
15301625
}
15311626

1532-
set(&mut config.llvm_tools_enabled, rust.llvm_tools);
1533-
config.rustc_parallel = rust
1534-
.parallel_compiler
1535-
.unwrap_or(config.channel == "dev" || config.channel == "nightly");
1536-
config.rustc_default_linker = rust.default_linker;
1537-
config.musl_root = rust.musl_root.map(PathBuf::from);
1538-
config.save_toolstates = rust.save_toolstates.map(PathBuf::from);
1627+
set(&mut config.llvm_tools_enabled, llvm_tools);
1628+
config.rustc_parallel =
1629+
parallel_compiler.unwrap_or(config.channel == "dev" || config.channel == "nightly");
1630+
config.rustc_default_linker = default_linker;
1631+
config.musl_root = musl_root.map(PathBuf::from);
1632+
config.save_toolstates = save_toolstates.map(PathBuf::from);
15391633
set(
15401634
&mut config.deny_warnings,
15411635
match flags.warnings {
15421636
Warnings::Deny => Some(true),
15431637
Warnings::Warn => Some(false),
1544-
Warnings::Default => rust.deny_warnings,
1638+
Warnings::Default => deny_warnings,
15451639
},
15461640
);
1547-
set(&mut config.backtrace_on_ice, rust.backtrace_on_ice);
1548-
set(&mut config.rust_verify_llvm_ir, rust.verify_llvm_ir);
1549-
config.rust_thin_lto_import_instr_limit = rust.thin_lto_import_instr_limit;
1550-
set(&mut config.rust_remap_debuginfo, rust.remap_debuginfo);
1551-
set(&mut config.control_flow_guard, rust.control_flow_guard);
1552-
set(&mut config.ehcont_guard, rust.ehcont_guard);
1553-
config.llvm_libunwind_default = rust
1554-
.llvm_libunwind
1555-
.map(|v| v.parse().expect("failed to parse rust.llvm-libunwind"));
1556-
1557-
if let Some(ref backends) = rust.codegen_backends {
1641+
set(&mut config.backtrace_on_ice, backtrace_on_ice);
1642+
set(&mut config.rust_verify_llvm_ir, verify_llvm_ir);
1643+
config.rust_thin_lto_import_instr_limit = thin_lto_import_instr_limit;
1644+
set(&mut config.rust_remap_debuginfo, remap_debuginfo);
1645+
set(&mut config.control_flow_guard, control_flow_guard);
1646+
set(&mut config.ehcont_guard, ehcont_guard);
1647+
config.llvm_libunwind_default =
1648+
llvm_libunwind.map(|v| v.parse().expect("failed to parse rust.llvm-libunwind"));
1649+
1650+
if let Some(ref backends) = codegen_backends {
15581651
let available_backends = vec!["llvm", "cranelift", "gcc"];
15591652

15601653
config.rust_codegen_backends = backends.iter().map(|s| {
@@ -1572,16 +1665,13 @@ impl Config {
15721665
}).collect();
15731666
}
15741667

1575-
config.rust_codegen_units = rust.codegen_units.map(threads_from_config);
1576-
config.rust_codegen_units_std = rust.codegen_units_std.map(threads_from_config);
1577-
config.rust_profile_use = flags.rust_profile_use.or(rust.profile_use);
1578-
config.rust_profile_generate = flags.rust_profile_generate.or(rust.profile_generate);
1579-
config.rust_lto = rust
1580-
.lto
1581-
.as_deref()
1582-
.map(|value| RustcLto::from_str(value).unwrap())
1583-
.unwrap_or_default();
1584-
config.rust_validate_mir_opts = rust.validate_mir_opts;
1668+
config.rust_codegen_units = codegen_units.map(threads_from_config);
1669+
config.rust_codegen_units_std = codegen_units_std.map(threads_from_config);
1670+
config.rust_profile_use = flags.rust_profile_use.or(profile_use);
1671+
config.rust_profile_generate = flags.rust_profile_generate.or(profile_generate);
1672+
config.rust_lto =
1673+
lto.as_deref().map(|value| RustcLto::from_str(value).unwrap()).unwrap_or_default();
1674+
config.rust_validate_mir_opts = validate_mir_opts;
15851675
} else {
15861676
config.rust_profile_use = flags.rust_profile_use;
15871677
config.rust_profile_generate = flags.rust_profile_generate;
@@ -1595,43 +1685,71 @@ impl Config {
15951685
config.rust_info = GitInfo::new(config.omit_git_hash, &config.src);
15961686

15971687
if let Some(llvm) = toml.llvm {
1598-
match llvm.ccache {
1688+
let Llvm {
1689+
optimize: optimize_toml,
1690+
thin_lto,
1691+
release_debuginfo,
1692+
assertions,
1693+
tests,
1694+
plugins,
1695+
ccache,
1696+
static_libstdcpp,
1697+
ninja,
1698+
targets,
1699+
experimental_targets,
1700+
link_jobs,
1701+
link_shared,
1702+
version_suffix,
1703+
clang_cl,
1704+
cflags,
1705+
cxxflags,
1706+
ldflags,
1707+
use_libcxx,
1708+
use_linker,
1709+
allow_old_toolchain,
1710+
polly,
1711+
clang,
1712+
enable_warnings,
1713+
download_ci_llvm,
1714+
build_config,
1715+
} = llvm;
1716+
match ccache {
15991717
Some(StringOrBool::String(ref s)) => config.ccache = Some(s.to_string()),
16001718
Some(StringOrBool::Bool(true)) => {
16011719
config.ccache = Some("ccache".to_string());
16021720
}
16031721
Some(StringOrBool::Bool(false)) | None => {}
16041722
}
1605-
set(&mut config.ninja_in_file, llvm.ninja);
1606-
llvm_assertions = llvm.assertions;
1607-
llvm_tests = llvm.tests;
1608-
llvm_plugins = llvm.plugins;
1609-
set(&mut config.llvm_optimize, llvm.optimize);
1610-
set(&mut config.llvm_thin_lto, llvm.thin_lto);
1611-
set(&mut config.llvm_release_debuginfo, llvm.release_debuginfo);
1612-
set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp);
1613-
if let Some(v) = llvm.link_shared {
1723+
set(&mut config.ninja_in_file, ninja);
1724+
llvm_assertions = assertions;
1725+
llvm_tests = tests;
1726+
llvm_plugins = plugins;
1727+
set(&mut config.llvm_optimize, optimize_toml);
1728+
set(&mut config.llvm_thin_lto, thin_lto);
1729+
set(&mut config.llvm_release_debuginfo, release_debuginfo);
1730+
set(&mut config.llvm_static_stdcpp, static_libstdcpp);
1731+
if let Some(v) = link_shared {
16141732
config.llvm_link_shared.set(Some(v));
16151733
}
1616-
config.llvm_targets = llvm.targets.clone();
1617-
config.llvm_experimental_targets = llvm.experimental_targets.clone();
1618-
config.llvm_link_jobs = llvm.link_jobs;
1619-
config.llvm_version_suffix = llvm.version_suffix.clone();
1620-
config.llvm_clang_cl = llvm.clang_cl.clone();
1621-
1622-
config.llvm_cflags = llvm.cflags.clone();
1623-
config.llvm_cxxflags = llvm.cxxflags.clone();
1624-
config.llvm_ldflags = llvm.ldflags.clone();
1625-
set(&mut config.llvm_use_libcxx, llvm.use_libcxx);
1626-
config.llvm_use_linker = llvm.use_linker.clone();
1627-
config.llvm_allow_old_toolchain = llvm.allow_old_toolchain.unwrap_or(false);
1628-
config.llvm_polly = llvm.polly.unwrap_or(false);
1629-
config.llvm_clang = llvm.clang.unwrap_or(false);
1630-
config.llvm_enable_warnings = llvm.enable_warnings.unwrap_or(false);
1631-
config.llvm_build_config = llvm.build_config.clone().unwrap_or(Default::default());
1734+
config.llvm_targets = targets.clone();
1735+
config.llvm_experimental_targets = experimental_targets.clone();
1736+
config.llvm_link_jobs = link_jobs;
1737+
config.llvm_version_suffix = version_suffix.clone();
1738+
config.llvm_clang_cl = clang_cl.clone();
1739+
1740+
config.llvm_cflags = cflags.clone();
1741+
config.llvm_cxxflags = cxxflags.clone();
1742+
config.llvm_ldflags = ldflags.clone();
1743+
set(&mut config.llvm_use_libcxx, use_libcxx);
1744+
config.llvm_use_linker = use_linker.clone();
1745+
config.llvm_allow_old_toolchain = allow_old_toolchain.unwrap_or(false);
1746+
config.llvm_polly = polly.unwrap_or(false);
1747+
config.llvm_clang = clang.unwrap_or(false);
1748+
config.llvm_enable_warnings = enable_warnings.unwrap_or(false);
1749+
config.llvm_build_config = build_config.clone().unwrap_or(Default::default());
16321750

16331751
let asserts = llvm_assertions.unwrap_or(false);
1634-
config.llvm_from_ci = config.parse_download_ci_llvm(llvm.download_ci_llvm, asserts);
1752+
config.llvm_from_ci = config.parse_download_ci_llvm(download_ci_llvm, asserts);
16351753

16361754
if config.llvm_from_ci {
16371755
// None of the LLVM options, except assertions, are supported
@@ -1640,31 +1758,31 @@ impl Config {
16401758
// explicitly set. The defaults and CI defaults don't
16411759
// necessarily match but forcing people to match (somewhat
16421760
// arbitrary) CI configuration locally seems bad/hard.
1643-
check_ci_llvm!(llvm.optimize);
1644-
check_ci_llvm!(llvm.thin_lto);
1645-
check_ci_llvm!(llvm.release_debuginfo);
1761+
check_ci_llvm!(optimize_toml);
1762+
check_ci_llvm!(thin_lto);
1763+
check_ci_llvm!(release_debuginfo);
16461764
// CI-built LLVM can be either dynamic or static. We won't know until we download it.
1647-
check_ci_llvm!(llvm.link_shared);
1648-
check_ci_llvm!(llvm.static_libstdcpp);
1649-
check_ci_llvm!(llvm.targets);
1650-
check_ci_llvm!(llvm.experimental_targets);
1651-
check_ci_llvm!(llvm.link_jobs);
1652-
check_ci_llvm!(llvm.clang_cl);
1653-
check_ci_llvm!(llvm.version_suffix);
1654-
check_ci_llvm!(llvm.cflags);
1655-
check_ci_llvm!(llvm.cxxflags);
1656-
check_ci_llvm!(llvm.ldflags);
1657-
check_ci_llvm!(llvm.use_libcxx);
1658-
check_ci_llvm!(llvm.use_linker);
1659-
check_ci_llvm!(llvm.allow_old_toolchain);
1660-
check_ci_llvm!(llvm.polly);
1661-
check_ci_llvm!(llvm.clang);
1662-
check_ci_llvm!(llvm.build_config);
1663-
check_ci_llvm!(llvm.plugins);
1765+
check_ci_llvm!(link_shared);
1766+
check_ci_llvm!(static_libstdcpp);
1767+
check_ci_llvm!(targets);
1768+
check_ci_llvm!(experimental_targets);
1769+
check_ci_llvm!(link_jobs);
1770+
check_ci_llvm!(clang_cl);
1771+
check_ci_llvm!(version_suffix);
1772+
check_ci_llvm!(cflags);
1773+
check_ci_llvm!(cxxflags);
1774+
check_ci_llvm!(ldflags);
1775+
check_ci_llvm!(use_libcxx);
1776+
check_ci_llvm!(use_linker);
1777+
check_ci_llvm!(allow_old_toolchain);
1778+
check_ci_llvm!(polly);
1779+
check_ci_llvm!(clang);
1780+
check_ci_llvm!(build_config);
1781+
check_ci_llvm!(plugins);
16641782
}
16651783

16661784
// NOTE: can never be hit when downloading from CI, since we call `check_ci_llvm!(thin_lto)` above.
1667-
if config.llvm_thin_lto && llvm.link_shared.is_none() {
1785+
if config.llvm_thin_lto && link_shared.is_none() {
16681786
// If we're building with ThinLTO on, by default we want to link
16691787
// to LLVM shared, to avoid re-doing ThinLTO (which happens in
16701788
// the link step) with each stage.
@@ -1730,17 +1848,26 @@ impl Config {
17301848
build_target.llvm_filecheck = Some(ci_llvm_bin.join(exe("FileCheck", config.build)));
17311849
}
17321850

1733-
if let Some(t) = toml.dist {
1734-
config.dist_sign_folder = t.sign_folder.map(PathBuf::from);
1735-
config.dist_upload_addr = t.upload_addr;
1736-
config.dist_compression_formats = t.compression_formats;
1737-
set(&mut config.dist_compression_profile, t.compression_profile);
1738-
set(&mut config.rust_dist_src, t.src_tarball);
1739-
set(&mut config.missing_tools, t.missing_tools);
1740-
set(&mut config.dist_include_mingw_linker, t.include_mingw_linker)
1851+
if let Some(dist) = toml.dist {
1852+
let Dist {
1853+
sign_folder,
1854+
upload_addr,
1855+
src_tarball,
1856+
missing_tools,
1857+
compression_formats,
1858+
compression_profile,
1859+
include_mingw_linker,
1860+
} = dist;
1861+
config.dist_sign_folder = sign_folder.map(PathBuf::from);
1862+
config.dist_upload_addr = upload_addr;
1863+
config.dist_compression_formats = compression_formats;
1864+
set(&mut config.dist_compression_profile, compression_profile);
1865+
set(&mut config.rust_dist_src, src_tarball);
1866+
set(&mut config.missing_tools, missing_tools);
1867+
set(&mut config.dist_include_mingw_linker, include_mingw_linker)
17411868
}
17421869

1743-
if let Some(r) = build.rustfmt {
1870+
if let Some(r) = rustfmt {
17441871
*config.initial_rustfmt.borrow_mut() = if r.exists() {
17451872
RustfmtState::SystemToolchain(r)
17461873
} else {
@@ -1781,20 +1908,20 @@ impl Config {
17811908
let download_rustc = config.download_rustc_commit.is_some();
17821909
// See https://github.com/rust-lang/compiler-team/issues/326
17831910
config.stage = match config.cmd {
1784-
Subcommand::Check { .. } => flags.stage.or(build.check_stage).unwrap_or(0),
1911+
Subcommand::Check { .. } => flags.stage.or(check_stage).unwrap_or(0),
17851912
// `download-rustc` only has a speed-up for stage2 builds. Default to stage2 unless explicitly overridden.
17861913
Subcommand::Doc { .. } => {
1787-
flags.stage.or(build.doc_stage).unwrap_or(if download_rustc { 2 } else { 0 })
1914+
flags.stage.or(doc_stage).unwrap_or(if download_rustc { 2 } else { 0 })
17881915
}
17891916
Subcommand::Build { .. } => {
1790-
flags.stage.or(build.build_stage).unwrap_or(if download_rustc { 2 } else { 1 })
1917+
flags.stage.or(build_stage).unwrap_or(if download_rustc { 2 } else { 1 })
17911918
}
17921919
Subcommand::Test { .. } => {
1793-
flags.stage.or(build.test_stage).unwrap_or(if download_rustc { 2 } else { 1 })
1920+
flags.stage.or(test_stage).unwrap_or(if download_rustc { 2 } else { 1 })
17941921
}
1795-
Subcommand::Bench { .. } => flags.stage.or(build.bench_stage).unwrap_or(2),
1796-
Subcommand::Dist { .. } => flags.stage.or(build.dist_stage).unwrap_or(2),
1797-
Subcommand::Install { .. } => flags.stage.or(build.install_stage).unwrap_or(2),
1922+
Subcommand::Bench { .. } => flags.stage.or(bench_stage).unwrap_or(2),
1923+
Subcommand::Dist { .. } => flags.stage.or(dist_stage).unwrap_or(2),
1924+
Subcommand::Install { .. } => flags.stage.or(install_stage).unwrap_or(2),
17981925
// These are all bootstrap tools, which don't depend on the compiler.
17991926
// The stage we pass shouldn't matter, but use 0 just in case.
18001927
Subcommand::Clean { .. }

‎src/bootstrap/src/utils/change_tracker.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
9191
severity: ChangeSeverity::Info,
9292
summary: "The `rust.use-lld` configuration now has different options ('external'/true or 'self-contained'), and its behaviour has changed.",
9393
},
94+
ChangeInfo {
95+
change_id: 118703,
96+
severity: ChangeSeverity::Info,
97+
summary: "Removed rust.run_dsymutil and dist.gpg_password_file config options, as they were unused.",
98+
},
9499
];

0 commit comments

Comments
 (0)
Please sign in to comment.