diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index b6f7abed6f3c9..c2981f914cf2d 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -1337,9 +1337,6 @@ fn ice_path_with_config(config: Option<&UnstableOptions>) -> &'static Option { if s == "0" { diff --git a/tests/run-make/dump-ice-to-disk/rmake.rs b/tests/run-make/dump-ice-to-disk/rmake.rs index 15f35eb2d3d88..094cea121191c 100644 --- a/tests/run-make/dump-ice-to-disk/rmake.rs +++ b/tests/run-make/dump-ice-to-disk/rmake.rs @@ -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 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 . //! //! # Test history @@ -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; @@ -103,6 +108,8 @@ fn main() { test_ice_dump_disabled(); test_metrics_dir(default_ice_dump); + + test_ice_dump_enabled_on_stable(); } #[track_caller] @@ -201,3 +208,25 @@ fn test_flag_and_env(baseline: &IceDump) { assert_ice_len_equals(baseline, &dump); }); } + +// See . +#[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:")); + }); +}