Skip to content

Commit 43caf83

Browse files
committed
Prefer debug! to never! and add regression test
1 parent b04e0df commit 43caf83

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Interface with `rustc_pattern_analysis`.
22
33
use std::fmt;
4+
use tracing::debug;
45

56
use hir_def::{DefWithBodyId, EnumVariantId, HasModule, LocalFieldId, ModuleId, VariantId};
67
use rustc_hash::FxHashMap;
@@ -475,7 +476,7 @@ impl<'p> TypeCx for MatchCheckCtx<'p> {
475476
}
476477

477478
fn bug(&self, fmt: fmt::Arguments<'_>) {
478-
never!("{}", fmt)
479+
debug!("{}", fmt)
479480
}
480481
}
481482

crates/ide-diagnostics/src/handlers/missing_match_arms.rs

+18
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,24 @@ fn main() {
310310
);
311311
}
312312

313+
#[test]
314+
fn mismatched_types_issue_15883() {
315+
// Check we don't panic.
316+
check_diagnostics_no_bails(
317+
r#"
318+
//- minicore: option
319+
fn main() {
320+
match Some((true, false)) {
321+
Some(true) | Some(false) => {}
322+
// ^^^^ error: expected (bool, bool), found bool
323+
// ^^^^^ error: expected (bool, bool), found bool
324+
None => {}
325+
}
326+
}
327+
"#,
328+
);
329+
}
330+
313331
#[test]
314332
fn mismatched_types_in_or_patterns() {
315333
cov_mark::check_count!(validate_match_bailed_out, 2);

0 commit comments

Comments
 (0)