bootstrap: pass --with-{rustc,std}-debug-assertions to compiletest

And rename local variables and field names in bootstrap from
`debug_assertions{,_std}` -> `{rustc,std}-debug-assertions` to avoid
confusion where applicable.
This commit is contained in:
许杰友 Jieyou Xu (Joe) 2024-10-21 17:53:52 +08:00
parent 65b986b94d
commit 3870022986
3 changed files with 26 additions and 21 deletions

View File

@ -1933,9 +1933,13 @@ fn run(self, builder: &Builder<'_>) {
cmd.arg("--json"); cmd.arg("--json");
if builder.config.rust_debug_assertions_std { if builder.config.rustc_debug_assertions {
cmd.arg("--with-debug-assertions"); cmd.arg("--with-rustc-debug-assertions");
}; }
if builder.config.std_debug_assertions {
cmd.arg("--with-std-debug-assertions");
}
let mut llvm_components_passed = false; let mut llvm_components_passed = false;
let mut copts_passed = false; let mut copts_passed = false;

View File

@ -833,9 +833,9 @@ fn cargo(
cargo.env( cargo.env(
profile_var("DEBUG_ASSERTIONS"), profile_var("DEBUG_ASSERTIONS"),
if mode == Mode::Std { if mode == Mode::Std {
self.config.rust_debug_assertions_std.to_string() self.config.std_debug_assertions.to_string()
} else { } else {
self.config.rust_debug_assertions.to_string() self.config.rustc_debug_assertions.to_string()
}, },
); );
cargo.env( cargo.env(

View File

@ -263,8 +263,10 @@ pub struct Config {
pub rust_optimize: RustOptimize, pub rust_optimize: RustOptimize,
pub rust_codegen_units: Option<u32>, pub rust_codegen_units: Option<u32>,
pub rust_codegen_units_std: Option<u32>, pub rust_codegen_units_std: Option<u32>,
pub rust_debug_assertions: bool,
pub rust_debug_assertions_std: bool, pub rustc_debug_assertions: bool,
pub std_debug_assertions: bool,
pub rust_overflow_checks: bool, pub rust_overflow_checks: bool,
pub rust_overflow_checks_std: bool, pub rust_overflow_checks_std: bool,
pub rust_debug_logging: bool, pub rust_debug_logging: bool,
@ -1115,9 +1117,9 @@ struct Rust {
debug: Option<bool> = "debug", debug: Option<bool> = "debug",
codegen_units: Option<u32> = "codegen-units", codegen_units: Option<u32> = "codegen-units",
codegen_units_std: Option<u32> = "codegen-units-std", codegen_units_std: Option<u32> = "codegen-units-std",
debug_assertions: Option<bool> = "debug-assertions", rustc_debug_assertions: Option<bool> = "debug-assertions",
randomize_layout: Option<bool> = "randomize-layout", randomize_layout: Option<bool> = "randomize-layout",
debug_assertions_std: Option<bool> = "debug-assertions-std", std_debug_assertions: Option<bool> = "debug-assertions-std",
overflow_checks: Option<bool> = "overflow-checks", overflow_checks: Option<bool> = "overflow-checks",
overflow_checks_std: Option<bool> = "overflow-checks-std", overflow_checks_std: Option<bool> = "overflow-checks-std",
debug_logging: Option<bool> = "debug-logging", debug_logging: Option<bool> = "debug-logging",
@ -1652,8 +1654,8 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
let mut llvm_offload = None; let mut llvm_offload = None;
let mut llvm_plugins = None; let mut llvm_plugins = None;
let mut debug = None; let mut debug = None;
let mut debug_assertions = None; let mut rustc_debug_assertions = None;
let mut debug_assertions_std = None; let mut std_debug_assertions = None;
let mut overflow_checks = None; let mut overflow_checks = None;
let mut overflow_checks_std = None; let mut overflow_checks_std = None;
let mut debug_logging = None; let mut debug_logging = None;
@ -1675,8 +1677,8 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
debug: debug_toml, debug: debug_toml,
codegen_units, codegen_units,
codegen_units_std, codegen_units_std,
debug_assertions: debug_assertions_toml, rustc_debug_assertions: rustc_debug_assertions_toml,
debug_assertions_std: debug_assertions_std_toml, std_debug_assertions: std_debug_assertions_toml,
overflow_checks: overflow_checks_toml, overflow_checks: overflow_checks_toml,
overflow_checks_std: overflow_checks_std_toml, overflow_checks_std: overflow_checks_std_toml,
debug_logging: debug_logging_toml, debug_logging: debug_logging_toml,
@ -1734,8 +1736,8 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
config.download_ci_rustc_commit(download_rustc, config.llvm_assertions); config.download_ci_rustc_commit(download_rustc, config.llvm_assertions);
debug = debug_toml; debug = debug_toml;
debug_assertions = debug_assertions_toml; rustc_debug_assertions = rustc_debug_assertions_toml;
debug_assertions_std = debug_assertions_std_toml; std_debug_assertions = std_debug_assertions_toml;
overflow_checks = overflow_checks_toml; overflow_checks = overflow_checks_toml;
overflow_checks_std = overflow_checks_std_toml; overflow_checks_std = overflow_checks_std_toml;
debug_logging = debug_logging_toml; debug_logging = debug_logging_toml;
@ -2148,14 +2150,13 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
config.rust_std_features = std_features.unwrap_or(default_std_features); config.rust_std_features = std_features.unwrap_or(default_std_features);
let default = debug == Some(true); let default = debug == Some(true);
config.rust_debug_assertions = debug_assertions.unwrap_or(default); config.rustc_debug_assertions = rustc_debug_assertions.unwrap_or(default);
config.rust_debug_assertions_std = config.std_debug_assertions = std_debug_assertions.unwrap_or(config.rustc_debug_assertions);
debug_assertions_std.unwrap_or(config.rust_debug_assertions);
config.rust_overflow_checks = overflow_checks.unwrap_or(default); config.rust_overflow_checks = overflow_checks.unwrap_or(default);
config.rust_overflow_checks_std = config.rust_overflow_checks_std =
overflow_checks_std.unwrap_or(config.rust_overflow_checks); overflow_checks_std.unwrap_or(config.rust_overflow_checks);
config.rust_debug_logging = debug_logging.unwrap_or(config.rust_debug_assertions); config.rust_debug_logging = debug_logging.unwrap_or(config.rustc_debug_assertions);
let with_defaults = |debuginfo_level_specific: Option<_>| { let with_defaults = |debuginfo_level_specific: Option<_>| {
debuginfo_level_specific.or(debuginfo_level).unwrap_or(if debug == Some(true) { debuginfo_level_specific.or(debuginfo_level).unwrap_or(if debug == Some(true) {
@ -3075,8 +3076,8 @@ macro_rules! warn {
debug: _, debug: _,
codegen_units: _, codegen_units: _,
codegen_units_std: _, codegen_units_std: _,
debug_assertions: _, rustc_debug_assertions: _,
debug_assertions_std: _, std_debug_assertions: _,
overflow_checks: _, overflow_checks: _,
overflow_checks_std: _, overflow_checks_std: _,
debuginfo_level: _, debuginfo_level: _,