diff options
author | CAD97 <[email protected]> | 2020-08-17 18:27:12 +0100 |
---|---|---|
committer | CAD97 <[email protected]> | 2020-08-17 18:27:12 +0100 |
commit | c822bb68ce78171e4017938a66118fc4ccf077d5 (patch) | |
tree | a73e2ad5d033c6f53357d3895b73b6a810e4a94c /crates/hir_ty/src | |
parent | 2eaf79cfbb447156151cb5435eff5f14f41c40f7 (diff) |
Fix missing match arm false error on unknown type
Diffstat (limited to 'crates/hir_ty/src')
-rw-r--r-- | crates/hir_ty/src/diagnostics/expr.rs | 4 | ||||
-rw-r--r-- | crates/hir_ty/src/diagnostics/match_check.rs | 2 |
2 files changed, 2 insertions, 4 deletions
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> { | |||
223 | db.body_with_source_map(self.owner.into()); | 223 | db.body_with_source_map(self.owner.into()); |
224 | 224 | ||
225 | let match_expr_ty = match infer.type_of_expr.get(match_expr) { | 225 | let match_expr_ty = match infer.type_of_expr.get(match_expr) { |
226 | Some(ty) => ty, | ||
227 | // If we can't resolve the type of the match expression | 226 | // If we can't resolve the type of the match expression |
228 | // we cannot perform exhaustiveness checks. | 227 | // we cannot perform exhaustiveness checks. |
229 | None => return, | 228 | None | Some(Ty::Unknown) => return, |
229 | Some(ty) => ty, | ||
230 | }; | 230 | }; |
231 | 231 | ||
232 | let cx = MatchCheckCtx { match_expr, body, infer: infer.clone(), db }; | 232 | 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) { | |||
1342 | enum Option<T> { Some(T), None } | 1342 | enum Option<T> { Some(T), None } |
1343 | 1343 | ||
1344 | fn main() { | 1344 | fn main() { |
1345 | // FIXME: This is a false positive, as the `Never` type is not known here. | ||
1346 | // `Never` is deliberately not defined so that it's an uninferred type. | 1345 | // `Never` is deliberately not defined so that it's an uninferred type. |
1347 | match Option::<Never>::None { | 1346 | match Option::<Never>::None { |
1348 | None => (), | 1347 | None => (), |
1349 | Some(never) => match never {}, | 1348 | Some(never) => match never {}, |
1350 | // ^^^^^ Missing match arm | ||
1351 | } | 1349 | } |
1352 | } | 1350 | } |
1353 | "#, | 1351 | "#, |