Skip to content

Commit 4537ecf

Browse files
authored
Unrolled build for #145976
Rollup merge of #145976 - beepster4096:configure_debugbreak, r=clubby789 Add bootstrap.toml option to control debug breaking on ICEs on windows When rustc ICEs during bootstrap on Windows, it will call `DebugBreak`. This is intended to trigger a Windows Error Reporting dialog that can launch a debugger. However on some setups (mine for one) this will just abort the process, hiding any ICEs on other threads as well. I also would not want to see this dialog even if it did work for me. This PR adds a new option to bootstrap.toml `rust.break-on-ice` to configure this behavior. By default, it is enabled, matching the existing behavior.
2 parents 71289c3 + 768dcbe commit 4537ecf

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

bootstrap.example.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,9 @@
856856
# as libstd features, this option can also be used to configure features such as optimize_for_size.
857857
#rust.std-features = ["panic_unwind"]
858858

859+
# Trigger a `DebugBreak` after an internal compiler error during bootstrap on Windows
860+
#rust.break-on-ice = true
861+
859862
# =============================================================================
860863
# Distribution options
861864
#

src/bootstrap/src/core/builder/cargo.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -878,8 +878,11 @@ impl Builder<'_> {
878878
.env("RUSTC_LIBDIR", libdir)
879879
.env("RUSTDOC", self.bootstrap_out.join("rustdoc"))
880880
.env("RUSTDOC_REAL", rustdoc_path)
881-
.env("RUSTC_ERROR_METADATA_DST", self.extended_error_dir())
882-
.env("RUSTC_BREAK_ON_ICE", "1");
881+
.env("RUSTC_ERROR_METADATA_DST", self.extended_error_dir());
882+
883+
if self.config.rust_break_on_ice {
884+
cargo.env("RUSTC_BREAK_ON_ICE", "1");
885+
}
883886

884887
// Set RUSTC_WRAPPER to the bootstrap shim, which switches between beta and in-tree
885888
// sysroot depending on whether we're building build scripts.

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ pub struct Config {
221221
pub rust_lto: RustcLto,
222222
pub rust_validate_mir_opts: Option<u32>,
223223
pub rust_std_features: BTreeSet<String>,
224+
pub rust_break_on_ice: bool,
224225
pub llvm_profile_use: Option<String>,
225226
pub llvm_profile_generate: bool,
226227
pub llvm_libunwind_default: Option<LlvmLibunwind>,
@@ -550,6 +551,7 @@ impl Config {
550551
strip: rust_strip,
551552
lld_mode: rust_lld_mode,
552553
std_features: rust_std_features,
554+
break_on_ice: rust_break_on_ice,
553555
} = toml.rust.unwrap_or_default();
554556

555557
let Llvm {
@@ -1269,6 +1271,7 @@ impl Config {
12691271
reproducible_artifacts: flags_reproducible_artifact,
12701272
reuse: build_reuse.map(PathBuf::from),
12711273
rust_analyzer_info,
1274+
rust_break_on_ice: rust_break_on_ice.unwrap_or(true),
12721275
rust_codegen_backends: rust_codegen_backends
12731276
.map(|backends| parse_codegen_backends(backends, "rust"))
12741277
.unwrap_or(vec![CodegenBackendKind::Llvm]),

src/bootstrap/src/core/config/toml/rust.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ define_config! {
6565
lto: Option<String> = "lto",
6666
validate_mir_opts: Option<u32> = "validate-mir-opts",
6767
std_features: Option<BTreeSet<String>> = "std-features",
68+
break_on_ice: Option<bool> = "break-on-ice",
6869
}
6970
}
7071

@@ -355,6 +356,7 @@ pub fn check_incompatible_options_for_ci_rustc(
355356
download_rustc: _,
356357
validate_mir_opts: _,
357358
frame_pointers: _,
359+
break_on_ice: _,
358360
} = ci_rust_config;
359361

360362
// There are two kinds of checks for CI rustc incompatible options:

src/bootstrap/src/utils/change_tracker.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,4 +536,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
536536
severity: ChangeSeverity::Warning,
537537
summary: "It is no longer possible to `x test` with stage 0, except for running compiletest and opting into `build.compiletest-allow-stage0`.",
538538
},
539+
ChangeInfo {
540+
change_id: 145976,
541+
severity: ChangeSeverity::Info,
542+
summary: "Added a new option `rust.break-on-ice` to control if internal compiler errors cause a debug break on Windows.",
543+
},
539544
];

0 commit comments

Comments
 (0)