Skip to content

Commit

Permalink
bootstrap: pass --with-{rustc,std}-debug-assertions to compiletest
Browse files Browse the repository at this point in the history
And rename local variables and field names in bootstrap from
`debug_assertions{,_std}` -> `{rustc,std}-debug-assertions` to avoid
confusion where applicable.
  • Loading branch information
jieyouxu committed Oct 31, 2024
1 parent 65b986b commit 3870022
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 21 deletions.
10 changes: 7 additions & 3 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1933,9 +1933,13 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the

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;
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/src/core/builder/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -833,9 +833,9 @@ impl Builder<'_> {
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(
Expand Down
33 changes: 17 additions & 16 deletions src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,10 @@ pub struct Config {
pub rust_optimize: RustOptimize,
pub rust_codegen_units: 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_std: bool,
pub rust_debug_logging: bool,
Expand Down Expand Up @@ -1115,9 +1117,9 @@ define_config! {
debug: Option<bool> = "debug",
codegen_units: Option<u32> = "codegen-units",
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",
debug_assertions_std: Option<bool> = "debug-assertions-std",
std_debug_assertions: Option<bool> = "debug-assertions-std",
overflow_checks: Option<bool> = "overflow-checks",
overflow_checks_std: Option<bool> = "overflow-checks-std",
debug_logging: Option<bool> = "debug-logging",
Expand Down Expand Up @@ -1652,8 +1654,8 @@ impl Config {
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;
Expand All @@ -1675,8 +1677,8 @@ impl Config {
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,
Expand Down Expand Up @@ -1734,8 +1736,8 @@ impl Config {
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;
Expand Down Expand Up @@ -2148,14 +2150,13 @@ impl Config {
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) {
Expand Down Expand Up @@ -3075,8 +3076,8 @@ fn check_incompatible_options_for_ci_rustc(
debug: _,
codegen_units: _,
codegen_units_std: _,
debug_assertions: _,
debug_assertions_std: _,
rustc_debug_assertions: _,
std_debug_assertions: _,
overflow_checks: _,
overflow_checks_std: _,
debuginfo_level: _,
Expand Down

0 comments on commit 3870022

Please sign in to comment.