about summary refs log tree commit diff
path: root/compiler/rustc_session/src/parse.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-07-20 01:29:17 +0000
committerbors <bors@rust-lang.org>2023-07-20 01:29:17 +0000
commita6cdd81eff52566542cecdc1ce381dbe42cf77fb (patch)
treed8c79736ebadbccb2caf9477add711b55a7c6151 /compiler/rustc_session/src/parse.rs
parent39f42ad9e8430a8abb06c262346e89593278c515 (diff)
parent217d97adb85d072c3d567cd8801021d3dc96223c (diff)
downloadrust-a6cdd81eff52566542cecdc1ce381dbe42cf77fb.tar.gz
rust-a6cdd81eff52566542cecdc1ce381dbe42cf77fb.zip
Auto merge of #108714 - estebank:ice_dump, r=oli-obk
On nightly, dump ICE backtraces to disk

Implement rust-lang/compiler-team#578.

When an ICE is encountered on nightly releases, the new rustc panic handler will also write the contents of the backtrace to disk. If any `delay_span_bug`s are encountered, their backtrace is also added to the file. The platform and rustc version will also be collected.

<img width="1032" alt="Screenshot 2023-03-03 at 2 13 25 PM" src="https://user-images.githubusercontent.com/1606434/222842420-8e039740-4042-4563-b31d-599677171acf.png">

The current behavior will *always* write to disk on nightly builds, regardless of whether the backtrace is printed to the terminal, unless the environment variable `RUSTC_ICE_DISK_DUMP` is set to `0`. This is a compromise and can be changed.
Diffstat (limited to 'compiler/rustc_session/src/parse.rs')
-rw-r--r--compiler/rustc_session/src/parse.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/compiler/rustc_session/src/parse.rs b/compiler/rustc_session/src/parse.rs
index d5326df9ad9..b0a67c564ce 100644
--- a/compiler/rustc_session/src/parse.rs
+++ b/compiler/rustc_session/src/parse.rs
@@ -231,6 +231,7 @@ impl ParseSess {
             Some(sm.clone()),
             None,
             fallback_bundle,
+            None,
         );
         ParseSess::with_span_handler(handler, sm)
     }
@@ -261,12 +262,20 @@ impl ParseSess {
     pub fn with_silent_emitter(fatal_note: Option<String>) -> Self {
         let fallback_bundle = fallback_fluent_bundle(Vec::new(), false);
         let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-        let fatal_handler =
-            Handler::with_tty_emitter(ColorConfig::Auto, false, None, None, None, fallback_bundle);
+        let fatal_handler = Handler::with_tty_emitter(
+            ColorConfig::Auto,
+            false,
+            None,
+            None,
+            None,
+            fallback_bundle,
+            None,
+        );
         let handler = Handler::with_emitter(
             false,
             None,
             Box::new(SilentEmitter { fatal_handler, fatal_note }),
+            None,
         );
         ParseSess::with_span_handler(handler, sm)
     }