mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Fix 'missing Ok in tail expr' validation
Because of the coercion change, the type mismatch now only happens on the block expression.
This commit is contained in:
parent
e37b6c5837
commit
c256a72b03
1 changed files with 4 additions and 3 deletions
|
@ -41,7 +41,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
|
|||
|
||||
let body_expr = &body[body.body_expr()];
|
||||
if let Expr::Block { statements: _, tail: Some(t) } = body_expr {
|
||||
self.validate_results_in_tail_expr(*t, db);
|
||||
self.validate_results_in_tail_expr(body.body_expr(), *t, db);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,8 +97,9 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
|
|||
}
|
||||
}
|
||||
|
||||
fn validate_results_in_tail_expr(&mut self, id: ExprId, db: &impl HirDatabase) {
|
||||
let mismatch = match self.infer.type_mismatch_for_expr(id) {
|
||||
fn validate_results_in_tail_expr(&mut self, body_id: ExprId, id: ExprId, db: &impl HirDatabase) {
|
||||
// the mismatch will be on the whole block currently
|
||||
let mismatch = match self.infer.type_mismatch_for_expr(body_id) {
|
||||
Some(m) => m,
|
||||
None => return,
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue