aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/expr
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2019-08-26 19:41:31 +0100
committerKirill Bulatov <[email protected]>2019-08-26 20:44:50 +0100
commitc256a72b039e849414245c563692feb41d1b051c (patch)
tree1806d5ee33fb3d0cee17cbc3380b894d5f7c560e /crates/ra_hir/src/expr
parente37b6c58378355347898cbdf1eef278137f6b461 (diff)
Fix 'missing Ok in tail expr' validation
Because of the coercion change, the type mismatch now only happens on the block expression.
Diffstat (limited to 'crates/ra_hir/src/expr')
-rw-r--r--crates/ra_hir/src/expr/validation.rs7
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 };