From 3870022986d62233ee83928dcba6040a7a1c9a99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E6=9D=B0=E5=8F=8B=20Jieyou=20Xu=20=28Joe=29?= <39484203+jieyouxu@users.noreply.github.com> Date: Mon, 21 Oct 2024 17:53:52 +0800 Subject: [PATCH] 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. --- src/bootstrap/src/core/build_steps/test.rs | 10 +++++-- src/bootstrap/src/core/builder/cargo.rs | 4 +-- src/bootstrap/src/core/config/config.rs | 33 +++++++++++----------- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 2ad1b39a87c..4aced4f1e32 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -1933,9 +1933,13 @@ fn run(self, builder: &Builder<'_>) { cmd.arg("--json"); - if builder.config.rust_debug_assertions_std { - cmd.arg("--with-debug-assertions"); - }; + if builder.config.rustc_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 copts_passed = false; diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs index c3d0994f164..134da5db96d 100644 --- a/src/bootstrap/src/core/builder/cargo.rs +++ b/src/bootstrap/src/core/builder/cargo.rs @@ -833,9 +833,9 @@ fn cargo( cargo.env( profile_var("DEBUG_ASSERTIONS"), if mode == Mode::Std { - self.config.rust_debug_assertions_std.to_string() + self.config.std_debug_assertions.to_string() } else { - self.config.rust_debug_assertions.to_string() + self.config.rustc_debug_assertions.to_string() }, ); cargo.env( diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index 8115aea033d..f977c285a74 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -263,8 +263,10 @@ pub struct Config { pub rust_optimize: RustOptimize, pub rust_codegen_units: Option, pub rust_codegen_units_std: Option, - 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_std: bool, pub rust_debug_logging: bool, @@ -1115,9 +1117,9 @@ struct Rust { debug: Option = "debug", codegen_units: Option = "codegen-units", codegen_units_std: Option = "codegen-units-std", - debug_assertions: Option = "debug-assertions", + rustc_debug_assertions: Option = "debug-assertions", randomize_layout: Option = "randomize-layout", - debug_assertions_std: Option = "debug-assertions-std", + std_debug_assertions: Option = "debug-assertions-std", overflow_checks: Option = "overflow-checks", overflow_checks_std: Option = "overflow-checks-std", debug_logging: Option = "debug-logging", @@ -1652,8 +1654,8 @@ fn get_table(option: &str) -> Result { let mut llvm_offload = None; let mut llvm_plugins = None; let mut debug = None; - let mut debug_assertions = None; - let mut debug_assertions_std = None; + let mut rustc_debug_assertions = None; + let mut std_debug_assertions = None; let mut overflow_checks = None; let mut overflow_checks_std = None; let mut debug_logging = None; @@ -1675,8 +1677,8 @@ fn get_table(option: &str) -> Result { debug: debug_toml, codegen_units, codegen_units_std, - debug_assertions: debug_assertions_toml, - debug_assertions_std: debug_assertions_std_toml, + rustc_debug_assertions: rustc_debug_assertions_toml, + std_debug_assertions: std_debug_assertions_toml, overflow_checks: overflow_checks_toml, overflow_checks_std: overflow_checks_std_toml, debug_logging: debug_logging_toml, @@ -1734,8 +1736,8 @@ fn get_table(option: &str) -> Result { config.download_ci_rustc_commit(download_rustc, config.llvm_assertions); debug = debug_toml; - debug_assertions = debug_assertions_toml; - debug_assertions_std = debug_assertions_std_toml; + rustc_debug_assertions = rustc_debug_assertions_toml; + std_debug_assertions = std_debug_assertions_toml; overflow_checks = overflow_checks_toml; overflow_checks_std = overflow_checks_std_toml; debug_logging = debug_logging_toml; @@ -2148,14 +2150,13 @@ fn get_table(option: &str) -> Result { config.rust_std_features = std_features.unwrap_or(default_std_features); let default = debug == Some(true); - config.rust_debug_assertions = debug_assertions.unwrap_or(default); - config.rust_debug_assertions_std = - debug_assertions_std.unwrap_or(config.rust_debug_assertions); + config.rustc_debug_assertions = rustc_debug_assertions.unwrap_or(default); + config.std_debug_assertions = std_debug_assertions.unwrap_or(config.rustc_debug_assertions); config.rust_overflow_checks = overflow_checks.unwrap_or(default); config.rust_overflow_checks_std = 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<_>| { debuginfo_level_specific.or(debuginfo_level).unwrap_or(if debug == Some(true) { @@ -3075,8 +3076,8 @@ macro_rules! warn { debug: _, codegen_units: _, codegen_units_std: _, - debug_assertions: _, - debug_assertions_std: _, + rustc_debug_assertions: _, + std_debug_assertions: _, overflow_checks: _, overflow_checks_std: _, debuginfo_level: _,