Prefer debug!
to never!
and add regression test
This commit is contained in:
parent
b04e0df1ce
commit
43caf8323a
@ -1,6 +1,7 @@
|
|||||||
//! Interface with `rustc_pattern_analysis`.
|
//! Interface with `rustc_pattern_analysis`.
|
||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
use tracing::debug;
|
||||||
|
|
||||||
use hir_def::{DefWithBodyId, EnumVariantId, HasModule, LocalFieldId, ModuleId, VariantId};
|
use hir_def::{DefWithBodyId, EnumVariantId, HasModule, LocalFieldId, ModuleId, VariantId};
|
||||||
use rustc_hash::FxHashMap;
|
use rustc_hash::FxHashMap;
|
||||||
@ -475,7 +476,7 @@ impl<'p> TypeCx for MatchCheckCtx<'p> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn bug(&self, fmt: fmt::Arguments<'_>) {
|
fn bug(&self, fmt: fmt::Arguments<'_>) {
|
||||||
never!("{}", fmt)
|
debug!("{}", fmt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,6 +310,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]
|
#[test]
|
||||||
fn mismatched_types_in_or_patterns() {
|
fn mismatched_types_in_or_patterns() {
|
||||||
cov_mark::check_count!(validate_match_bailed_out, 2);
|
cov_mark::check_count!(validate_match_bailed_out, 2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user