From c822bb68ce78171e4017938a66118fc4ccf077d5 Mon Sep 17 00:00:00 2001 From: CAD97 Date: Mon, 17 Aug 2020 13:27:12 -0400 Subject: Fix missing match arm false error on unknown type --- crates/hir_ty/src/diagnostics/expr.rs | 4 ++-- crates/hir_ty/src/diagnostics/match_check.rs | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'crates/hir_ty/src') diff --git a/crates/hir_ty/src/diagnostics/expr.rs b/crates/hir_ty/src/diagnostics/expr.rs index fb76e2e4e..278a4b947 100644 --- a/crates/hir_ty/src/diagnostics/expr.rs +++ b/crates/hir_ty/src/diagnostics/expr.rs @@ -223,10 +223,10 @@ impl<'a, 'b> ExprValidator<'a, 'b> { db.body_with_source_map(self.owner.into()); 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 // 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 }; diff --git a/crates/hir_ty/src/diagnostics/match_check.rs b/crates/hir_ty/src/diagnostics/match_check.rs index 1602c3fb4..5bd03f2ac 100644 --- a/crates/hir_ty/src/diagnostics/match_check.rs +++ b/crates/hir_ty/src/diagnostics/match_check.rs @@ -1342,12 +1342,10 @@ fn panic(a: Category, b: Category) { enum Option { Some(T), None } 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. match Option::::None { None => (), Some(never) => match never {}, - // ^^^^^ Missing match arm } } "#, -- cgit v1.2.3