diff options
Diffstat (limited to 'crates/ra_hir')
-rw-r--r-- | crates/ra_hir/src/expr/validation.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/ra_hir/src/expr/validation.rs b/crates/ra_hir/src/expr/validation.rs index 5d9d59ff8..c99c9c869 100644 --- a/crates/ra_hir/src/expr/validation.rs +++ b/crates/ra_hir/src/expr/validation.rs | |||
@@ -41,7 +41,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
41 | 41 | ||
42 | let body_expr = &body[body.body_expr()]; | 42 | let body_expr = &body[body.body_expr()]; |
43 | if let Expr::Block { statements: _, tail: Some(t) } = body_expr { | 43 | if let Expr::Block { statements: _, tail: Some(t) } = body_expr { |
44 | self.validate_results_in_tail_expr(*t, db); | 44 | self.validate_results_in_tail_expr(body.body_expr(), *t, db); |
45 | } | 45 | } |
46 | } | 46 | } |
47 | 47 | ||
@@ -97,8 +97,9 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
97 | } | 97 | } |
98 | } | 98 | } |
99 | 99 | ||
100 | fn validate_results_in_tail_expr(&mut self, id: ExprId, db: &impl HirDatabase) { | 100 | fn validate_results_in_tail_expr(&mut self, body_id: ExprId, id: ExprId, db: &impl HirDatabase) { |
101 | let mismatch = match self.infer.type_mismatch_for_expr(id) { | 101 | // the mismatch will be on the whole block currently |
102 | let mismatch = match self.infer.type_mismatch_for_expr(body_id) { | ||
102 | Some(m) => m, | 103 | Some(m) => m, |
103 | None => return, | 104 | None => return, |
104 | }; | 105 | }; |