Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Also emit ICE dump files on stable rustc #133209

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1337,9 +1337,6 @@ fn ice_path_with_config(config: Option<&UnstableOptions>) -> &'static Option<Pat
}

ICE_PATH.get_or_init(|| {
if !rustc_feature::UnstableFeatures::from_environment(None).is_nightly_build() {
return None;
}
let mut path = match std::env::var_os("RUSTC_ICE") {
Some(s) => {
if s == "0" {
Expand Down
31 changes: 30 additions & 1 deletion tests/run-make/dump-ice-to-disk/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
//! - When `RUSTC_ICE=RUSTC_ICE_PATH` and `-Zmetrics-dir=METRICS_PATH` are both provided, check
//! that `RUSTC_ICE_PATH` takes precedence and no ICE dump is emitted under `METRICS_PATH`.
//!
//! In addition, previously in <https://github.com/rust-lang/rust/pull/108714> we only enabled ICE
//! file dumps in nightly to be conservative in case the ICE dumping infra had issues. After a
//! sufficient amount of time (#108714 was merged on Jul 2023, it is Nov 2024 as of the time of
//! writing this paragraph), we enable ICE dumps also on stable.
//!
//! See <https://github.com/rust-lang/rust/pull/108714>.
//!
//! # Test history
Expand All @@ -23,7 +28,7 @@
//! - An attempt is made to re-enable this test on `i686-mingw` (by removing `ignore-windows`). If
//! this test is still flakey, please restore the `ignore-windows` directive.

//@ ignore-windows
//@ ignore-windows-gnu
//FIXME(#128911): still flakey on i686-mingw.

use std::cell::OnceCell;
Expand Down Expand Up @@ -103,6 +108,8 @@ fn main() {
test_ice_dump_disabled();

test_metrics_dir(default_ice_dump);

test_ice_dump_enabled_on_stable();
}

#[track_caller]
Expand Down Expand Up @@ -201,3 +208,25 @@ fn test_flag_and_env(baseline: &IceDump) {
assert_ice_len_equals(baseline, &dump);
});
}

// See <https://github.com/rust-lang/rust/issues/132245>.
#[track_caller]
fn test_ice_dump_enabled_on_stable() {
run_in_tmpdir(|| {
rustc()
.env("RUSTC_ICE", cwd())
// We are very stable! (Pretend that we are stable compiler, cannot use `-Z
// treat-err-as-bug=1`).
.env("RUSTC_BOOTSTRAP", "-1")
// Realize Hyrum's law and make this a load-bearing easter egg. We need something to
// make a stable compiler ICE.
.stdin_buf("fn main() { break rust; }")
.arg("-")
.run_fail();
let dump = extract_exactly_one_ice_file("stable_baseline", cwd());

// Basic sanity check.
assert!(dump.message.contains("thread 'rustc' panicked at"));
assert!(dump.message.contains("stack backtrace:"));
});
}
Loading