Skip to content

Commit 048fe53

Browse files
committed
Don't invoke the default panic hook from report_ice
1 parent 68424e2 commit 048fe53

File tree

1 file changed

+11
-8
lines changed
  • compiler/rustc_driver/src

1 file changed

+11
-8
lines changed

compiler/rustc_driver/src/lib.rs

+11-8
Original file line numberDiff line numberDiff line change
@@ -1151,23 +1151,26 @@ pub fn catch_with_exit_code(f: impl FnOnce() -> interface::Result<()>) -> i32 {
11511151
static DEFAULT_HOOK: SyncLazy<Box<dyn Fn(&panic::PanicInfo<'_>) + Sync + Send + 'static>> =
11521152
SyncLazy::new(|| {
11531153
let hook = panic::take_hook();
1154-
panic::set_hook(Box::new(|info| report_ice(info, BUG_REPORT_URL)));
1154+
panic::set_hook(Box::new(|info| {
1155+
// Invoke the default handler, which prints the actual panic message and optionally a backtrace
1156+
(*DEFAULT_HOOK)(info);
1157+
1158+
// Separate the output with an empty line
1159+
eprintln!();
1160+
1161+
// Print the ICE message
1162+
report_ice(info, BUG_REPORT_URL);
1163+
}));
11551164
hook
11561165
});
11571166

1158-
/// Prints the ICE message, including backtrace and query stack.
1167+
/// Prints the ICE message, including query stack, but without backtrace.
11591168
///
11601169
/// The message will point the user at `bug_report_url` to report the ICE.
11611170
///
11621171
/// When `install_ice_hook` is called, this function will be called as the panic
11631172
/// hook.
11641173
pub fn report_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
1165-
// Invoke the default handler, which prints the actual panic message and optionally a backtrace
1166-
(*DEFAULT_HOOK)(info);
1167-
1168-
// Separate the output with an empty line
1169-
eprintln!();
1170-
11711174
let emitter = Box::new(rustc_errors::emitter::EmitterWriter::stderr(
11721175
rustc_errors::ColorConfig::Auto,
11731176
None,

0 commit comments

Comments
 (0)