diff options
| author | bors <bors@rust-lang.org> | 2023-07-20 01:29:17 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-07-20 01:29:17 +0000 |
| commit | a6cdd81eff52566542cecdc1ce381dbe42cf77fb (patch) | |
| tree | d8c79736ebadbccb2caf9477add711b55a7c6151 /compiler/rustc_session | |
| parent | 39f42ad9e8430a8abb06c262346e89593278c515 (diff) | |
| parent | 217d97adb85d072c3d567cd8801021d3dc96223c (diff) | |
| download | rust-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')
| -rw-r--r-- | compiler/rustc_session/src/parse.rs | 13 | ||||
| -rw-r--r-- | compiler/rustc_session/src/session.rs | 6 |
2 files changed, 15 insertions, 4 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) } diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index c65d933bd6d..0f5d3b291db 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -1392,6 +1392,7 @@ pub fn build_session( file_loader: Option<Box<dyn FileLoader + Send + Sync + 'static>>, target_override: Option<Target>, cfg_version: &'static str, + ice_file: Option<PathBuf>, ) -> Session { // FIXME: This is not general enough to make the warning lint completely override // normal diagnostic warnings, since the warning lint can also be denied and changed @@ -1440,6 +1441,7 @@ pub fn build_session( let span_diagnostic = rustc_errors::Handler::with_emitter_and_flags( emitter, sopts.unstable_opts.diagnostic_handler_flags(can_emit_warnings), + ice_file, ); let self_profiler = if let SwitchWithOptPath::Enabled(ref d) = sopts.unstable_opts.self_profile @@ -1731,7 +1733,7 @@ pub struct EarlyErrorHandler { impl EarlyErrorHandler { pub fn new(output: ErrorOutputType) -> Self { let emitter = mk_emitter(output); - Self { handler: rustc_errors::Handler::with_emitter(true, None, emitter) } + Self { handler: rustc_errors::Handler::with_emitter(true, None, emitter, None) } } pub fn abort_if_errors(&self) { @@ -1745,7 +1747,7 @@ impl EarlyErrorHandler { self.handler.abort_if_errors(); let emitter = mk_emitter(output); - self.handler = Handler::with_emitter(true, None, emitter); + self.handler = Handler::with_emitter(true, None, emitter, None); } #[allow(rustc::untranslatable_diagnostic)] |
