Rollup merge of #117397 - compiler-errors:dont-emit-good-path-on-panic, r=TaKO8Ki

Don't emit delayed good-path bugs on panic

This should fix #117381, cc ``@RalfJung``

As opposed to delayed bugs, delayed *good path* bugs really don't make sense to show on panics.
This commit is contained in:
Matthias Krüger 2023-11-01 11:29:41 +01:00 committed by GitHub
commit 6bbe22c966
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -556,7 +556,7 @@ impl Drop for HandlerInner {
// instead of "require some error happened". Sadly that isn't ideal, as
// lints can be `#[allow]`'d, potentially leading to this triggering.
// Also, "good path" should be replaced with a better naming.
if !self.has_any_message() && !self.suppressed_expected_diag {
if !self.has_any_message() && !self.suppressed_expected_diag && !std::thread::panicking() {
let bugs = std::mem::replace(&mut self.delayed_good_path_bugs, Vec::new());
self.flush_delayed(
bugs,