diff --git a/crates/ra_hir_ty/src/expr.rs b/crates/ra_hir_ty/src/expr.rs index 19323fda12..1e7395b164 100644 --- a/crates/ra_hir_ty/src/expr.rs +++ b/crates/ra_hir_ty/src/expr.rs @@ -88,6 +88,11 @@ impl<'a, 'b> ExprValidator<'a, 'b> { let mut seen = Matrix::empty(); for pat in pats { // We skip any patterns whose type we cannot resolve. + // + // This could lead to false positives in this diagnostic, so + // it might be better to skip the entire diagnostic if we either + // cannot resolve a match arm or determine that the match arm has + // the wrong type. if let Some(pat_ty) = infer.type_of_pat.get(pat) { // We only include patterns whose type matches the type // of the match expression. If we had a InvalidMatchArmPattern @@ -97,6 +102,8 @@ impl<'a, 'b> ExprValidator<'a, 'b> { // When comparing the types, we also have to consider that rustc // will automatically de-reference the match expression type if // necessary. + // + // FIXME we should use the type checker for this. if pat_ty == match_expr_ty || match_expr_ty .as_reference()