Skip to content

Commit 768dcbe

Browse files
committed
add rust.break-on-ice to bootstrap.toml
1 parent 75ee9ff commit 768dcbe

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
@@ -877,8 +877,11 @@ impl Builder<'_> {
877877
.env("RUSTC_LIBDIR", libdir)
878878
.env("RUSTDOC", self.bootstrap_out.join("rustdoc"))
879879
.env("RUSTDOC_REAL", rustdoc_path)
880-
.env("RUSTC_ERROR_METADATA_DST", self.extended_error_dir())
881-
.env("RUSTC_BREAK_ON_ICE", "1");
880+
.env("RUSTC_ERROR_METADATA_DST", self.extended_error_dir());
881+
882+
if self.config.rust_break_on_ice {
883+
cargo.env("RUSTC_BREAK_ON_ICE", "1");
884+
}
882885

883886
// Set RUSTC_WRAPPER to the bootstrap shim, which switches between beta and in-tree
884887
// 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)