mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
Fix missing match arm false error on unknown type
This commit is contained in:
parent
2eaf79cfbb
commit
c822bb68ce
2 changed files with 2 additions and 4 deletions
|
@ -223,10 +223,10 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
|
||||||
db.body_with_source_map(self.owner.into());
|
db.body_with_source_map(self.owner.into());
|
||||||
|
|
||||||
let match_expr_ty = match infer.type_of_expr.get(match_expr) {
|
let match_expr_ty = match infer.type_of_expr.get(match_expr) {
|
||||||
Some(ty) => ty,
|
|
||||||
// If we can't resolve the type of the match expression
|
// If we can't resolve the type of the match expression
|
||||||
// we cannot perform exhaustiveness checks.
|
// we cannot perform exhaustiveness checks.
|
||||||
None => return,
|
None | Some(Ty::Unknown) => return,
|
||||||
|
Some(ty) => ty,
|
||||||
};
|
};
|
||||||
|
|
||||||
let cx = MatchCheckCtx { match_expr, body, infer: infer.clone(), db };
|
let cx = MatchCheckCtx { match_expr, body, infer: infer.clone(), db };
|
||||||
|
|
|
@ -1342,12 +1342,10 @@ fn panic(a: Category, b: Category) {
|
||||||
enum Option<T> { Some(T), None }
|
enum Option<T> { Some(T), None }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// FIXME: This is a false positive, as the `Never` type is not known here.
|
|
||||||
// `Never` is deliberately not defined so that it's an uninferred type.
|
// `Never` is deliberately not defined so that it's an uninferred type.
|
||||||
match Option::<Never>::None {
|
match Option::<Never>::None {
|
||||||
None => (),
|
None => (),
|
||||||
Some(never) => match never {},
|
Some(never) => match never {},
|
||||||
// ^^^^^ Missing match arm
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue