From 8eb5843a592afbee8ae5352828f8f0b74034b9e0 Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Fri, 3 Mar 2023 22:25:18 +0000 Subject: 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. --- compiler/rustc_interface/src/interface.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'compiler/rustc_interface/src/interface.rs') diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs index 3f420f19efe..5b417e008cf 100644 --- a/compiler/rustc_interface/src/interface.rs +++ b/compiler/rustc_interface/src/interface.rs @@ -251,6 +251,7 @@ pub struct Config { pub input: Input, pub output_dir: Option, pub output_file: Option, + pub ice_file: Option, pub file_loader: Option>, pub locale_resources: &'static [&'static str], @@ -315,6 +316,7 @@ pub fn run_compiler(config: Config, f: impl FnOnce(&Compiler) -> R + Se config.lint_caps, config.make_codegen_backend, registry.clone(), + config.ice_file, ); if let Some(parse_sess_created) = config.parse_sess_created { @@ -346,7 +348,11 @@ pub fn run_compiler(config: Config, f: impl FnOnce(&Compiler) -> R + Se ) } -pub fn try_print_query_stack(handler: &Handler, num_frames: Option) { +pub fn try_print_query_stack( + handler: &Handler, + num_frames: Option, + file: Option, +) { eprintln!("query stack during panic:"); // Be careful relying on global state here: this code is called from @@ -358,7 +364,8 @@ pub fn try_print_query_stack(handler: &Handler, num_frames: Option) { QueryCtxt::new(icx.tcx), icx.query, handler, - num_frames + num_frames, + file, )) } else { 0 -- cgit 1.4.1-3-g733a5