Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs3
-rw-r--r--crates/ide-diagnostics/src/handlers/missing_match_arms.rs18
2 files changed, 20 insertions, 1 deletions
diff --git a/crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs b/crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs
index e57abb6495..e98a946a87 100644
--- a/crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs
+++ b/crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs
@@ -1,6 +1,7 @@
//! Interface with `rustc_pattern_analysis`.
use std::fmt;
+use tracing::debug;
use hir_def::{DefWithBodyId, EnumVariantId, HasModule, LocalFieldId, ModuleId, VariantId};
use rustc_hash::FxHashMap;
@@ -475,7 +476,7 @@ impl<'p> TypeCx for MatchCheckCtx<'p> {
}
fn bug(&self, fmt: fmt::Arguments<'_>) {
- never!("{}", fmt)
+ debug!("{}", fmt)
}
}
diff --git a/crates/ide-diagnostics/src/handlers/missing_match_arms.rs b/crates/ide-diagnostics/src/handlers/missing_match_arms.rs
index 17dc679e05..7632fdf1d0 100644
--- a/crates/ide-diagnostics/src/handlers/missing_match_arms.rs
+++ b/crates/ide-diagnostics/src/handlers/missing_match_arms.rs
@@ -311,6 +311,24 @@ fn main() {
}
#[test]
+ fn mismatched_types_issue_15883() {
+ // Check we don't panic.
+ check_diagnostics_no_bails(
+ r#"
+//- minicore: option
+fn main() {
+ match Some((true, false)) {
+ Some(true) | Some(false) => {}
+ // ^^^^ error: expected (bool, bool), found bool
+ // ^^^^^ error: expected (bool, bool), found bool
+ None => {}
+ }
+}
+ "#,
+ );
+ }
+
+ #[test]
fn mismatched_types_in_or_patterns() {
cov_mark::check_count!(validate_match_bailed_out, 2);
check_diagnostics(