|
13 | 13 | //! - When `RUSTC_ICE=RUSTC_ICE_PATH` and `-Zmetrics-dir=METRICS_PATH` are both provided, check
|
14 | 14 | //! that `RUSTC_ICE_PATH` takes precedence and no ICE dump is emitted under `METRICS_PATH`.
|
15 | 15 | //!
|
| 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 | +//! |
16 | 21 | //! See <https://github.com/rust-lang/rust/pull/108714>.
|
17 | 22 | //!
|
18 | 23 | //! # Test history
|
@@ -103,6 +108,8 @@ fn main() {
|
103 | 108 | test_ice_dump_disabled();
|
104 | 109 |
|
105 | 110 | test_metrics_dir(default_ice_dump);
|
| 111 | + |
| 112 | + test_ice_dump_enabled_on_stable(); |
106 | 113 | }
|
107 | 114 |
|
108 | 115 | #[track_caller]
|
@@ -201,3 +208,25 @@ fn test_flag_and_env(baseline: &IceDump) {
|
201 | 208 | assert_ice_len_equals(baseline, &dump);
|
202 | 209 | });
|
203 | 210 | }
|
| 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