From 36bbb4238d04dd1eae97ccc83b8eba90650dd0bf Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Wed, 13 Nov 2024 16:31:27 +0800 Subject: [PATCH 1/3] Also emit ICE dump files on stable cf. where originally we made it nightly-only in case there was some problems with the ICE dumping infra breaking stable users. However, a good amount of time has since passed and such bugs have not materialized. It was also waiting for cargo gc work, but the timeline of that is unclear. Also note that ICE dumping is already perma-unstable behavior, so if this somehow is problematic it is very easy to revert. --- compiler/rustc_driver_impl/src/lib.rs | 3 --- 1 file changed, 3 deletions(-) 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" { From 165289a7c57af834383642a8b6337937aa72abeb Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Tue, 19 Nov 2024 21:54:21 +0800 Subject: [PATCH 2/3] Enable the `dump-ice-to-disk` for msvc It was only flaky for i686-mingw (windows-gnu), it seemed reasonably reliable for msvc. --- tests/run-make/dump-ice-to-disk/rmake.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run-make/dump-ice-to-disk/rmake.rs b/tests/run-make/dump-ice-to-disk/rmake.rs index 15f35eb2d3d88..45c07d7365218 100644 --- a/tests/run-make/dump-ice-to-disk/rmake.rs +++ b/tests/run-make/dump-ice-to-disk/rmake.rs @@ -23,7 +23,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; From d11ffe7d69d8bad35e9212694cfe17bb0d0c393e Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Wed, 13 Nov 2024 16:52:30 +0800 Subject: [PATCH 3/3] Add a basic sanity check for ICE dump file emitted on stable rustc --- tests/run-make/dump-ice-to-disk/rmake.rs | 29 ++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/run-make/dump-ice-to-disk/rmake.rs b/tests/run-make/dump-ice-to-disk/rmake.rs index 45c07d7365218..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 @@ -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:")); + }); +}