From 472317c00870c007f552cde1f3c490e04f29919a Mon Sep 17 00:00:00 2001 From: Dawer <7803845+iDawer@users.noreply.github.com> Date: Wed, 19 May 2021 09:23:16 +0500 Subject: internal: Record mismatches of pattern types. --- crates/hir_ty/src/infer/expr.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'crates/hir_ty/src/infer/expr.rs') diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index b6b5a1b75..7278faeec 100644 --- a/crates/hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs @@ -42,7 +42,7 @@ impl<'a> InferenceContext<'a> { let could_unify = self.unify(&ty, &expected.ty); if !could_unify { self.result.type_mismatches.insert( - tgt_expr, + tgt_expr.into(), TypeMismatch { expected: expected.ty.clone(), actual: ty.clone() }, ); } @@ -54,9 +54,10 @@ impl<'a> InferenceContext<'a> { pub(super) fn infer_expr_coerce(&mut self, expr: ExprId, expected: &Expectation) -> Ty { let ty = self.infer_expr_inner(expr, &expected); let ty = if !self.coerce(&ty, &expected.coercion_target()) { - self.result - .type_mismatches - .insert(expr, TypeMismatch { expected: expected.ty.clone(), actual: ty.clone() }); + self.result.type_mismatches.insert( + expr.into(), + TypeMismatch { expected: expected.ty.clone(), actual: ty.clone() }, + ); // Return actual type when type mismatch. // This is needed for diagnostic when return type mismatch. ty -- cgit v1.2.3