Skip to content

Commit d11ffe7

Browse files
committed
Add a basic sanity check for ICE dump file emitted on stable rustc
1 parent 165289a commit d11ffe7

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/run-make/dump-ice-to-disk/rmake.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
//! - When `RUSTC_ICE=RUSTC_ICE_PATH` and `-Zmetrics-dir=METRICS_PATH` are both provided, check
1414
//! that `RUSTC_ICE_PATH` takes precedence and no ICE dump is emitted under `METRICS_PATH`.
1515
//!
16+
//! In addition, previously in <https://github.com/rust-lang/rust/pull/108714> we only enabled ICE
17+
//! file dumps in nightly to be conservative in case the ICE dumping infra had issues. After a
18+
//! sufficient amount of time (#108714 was merged on Jul 2023, it is Nov 2024 as of the time of
19+
//! writing this paragraph), we enable ICE dumps also on stable.
20+
//!
1621
//! See <https://github.com/rust-lang/rust/pull/108714>.
1722
//!
1823
//! # Test history
@@ -103,6 +108,8 @@ fn main() {
103108
test_ice_dump_disabled();
104109

105110
test_metrics_dir(default_ice_dump);
111+
112+
test_ice_dump_enabled_on_stable();
106113
}
107114

108115
#[track_caller]
@@ -201,3 +208,25 @@ fn test_flag_and_env(baseline: &IceDump) {
201208
assert_ice_len_equals(baseline, &dump);
202209
});
203210
}
211+
212+
// See <https://github.com/rust-lang/rust/issues/132245>.
213+
#[track_caller]
214+
fn test_ice_dump_enabled_on_stable() {
215+
run_in_tmpdir(|| {
216+
rustc()
217+
.env("RUSTC_ICE", cwd())
218+
// We are very stable! (Pretend that we are stable compiler, cannot use `-Z
219+
// treat-err-as-bug=1`).
220+
.env("RUSTC_BOOTSTRAP", "-1")
221+
// Realize Hyrum's law and make this a load-bearing easter egg. We need something to
222+
// make a stable compiler ICE.
223+
.stdin_buf("fn main() { break rust; }")
224+
.arg("-")
225+
.run_fail();
226+
let dump = extract_exactly_one_ice_file("stable_baseline", cwd());
227+
228+
// Basic sanity check.
229+
assert!(dump.message.contains("thread 'rustc' panicked at"));
230+
assert!(dump.message.contains("stack backtrace:"));
231+
});
232+
}

0 commit comments

Comments
 (0)