about summary refs log tree commit diff
path: root/compiler/rustc_driver
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-12-31 01:20:59 +0000
committerMichael Goulet <michael@errs.io>2022-12-31 02:14:26 +0000
commit5d62a737d7e7899461f18c3ec105f7f024aeee74 (patch)
treea0aae147614d01a0754f8886f82fcc74e936a40c /compiler/rustc_driver
parent7c991868c60a4afc1ee6334b912ea96061a2c98d (diff)
downloadrust-5d62a737d7e7899461f18c3ec105f7f024aeee74.tar.gz
rust-5d62a737d7e7899461f18c3ec105f7f024aeee74.zip
Only deduplicate stack traces for good path bugs
Diffstat (limited to 'compiler/rustc_driver')
-rw-r--r--compiler/rustc_driver/src/lib.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/rustc_driver/src/lib.rs b/compiler/rustc_driver/src/lib.rs
index 31e08c44d29..30179e97872 100644
--- a/compiler/rustc_driver/src/lib.rs
+++ b/compiler/rustc_driver/src/lib.rs
@@ -1199,8 +1199,8 @@ static DEFAULT_HOOK: LazyLock<Box<dyn Fn(&panic::PanicInfo<'_>) + Sync + Send +
             };
 
             // Invoke the default handler, which prints the actual panic message and optionally a backtrace
-            // Don't do this for `ExplicitBug`, which has an unhelpful message and backtrace.
-            if !info.payload().is::<rustc_errors::ExplicitBug>() {
+            // Don't do this for `GoodPathBug`, which already emits its own more useful backtrace.
+            if !info.payload().is::<rustc_errors::GoodPathBug>() {
                 (*DEFAULT_HOOK)(info);
 
                 // Separate the output with an empty line
@@ -1237,7 +1237,9 @@ pub fn report_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
 
     // a .span_bug or .bug call has already printed what
     // it wants to print.
-    if !info.payload().is::<rustc_errors::ExplicitBug>() {
+    if !info.payload().is::<rustc_errors::ExplicitBug>()
+        && !info.payload().is::<rustc_errors::GoodPathBug>()
+    {
         let mut d = rustc_errors::Diagnostic::new(rustc_errors::Level::Bug, "unexpected panic");
         handler.emit_diagnostic(&mut d);
     }