diff options
author | Daniel McNab <[email protected]> | 2021-04-07 12:45:17 +0100 |
---|---|---|
committer | Daniel McNab <[email protected]> | 2021-05-03 14:13:05 +0100 |
commit | ebbcf9f458522e76c5a84e6771e0ef434d6d5c5b (patch) | |
tree | 05b4684b1b23a5159796d424b511d30e7e651df5 /crates/hir_ty | |
parent | eb741e895f1a73420a401f2495c711afe37d9d19 (diff) |
Fix inference with conditionally compiled tails
Fixes #8378
Diffstat (limited to 'crates/hir_ty')
-rw-r--r-- | crates/hir_ty/src/diagnostics/expr.rs | 2 | ||||
-rw-r--r-- | crates/hir_ty/src/infer/expr.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/crates/hir_ty/src/diagnostics/expr.rs b/crates/hir_ty/src/diagnostics/expr.rs index 79602c3dd..47709c1e8 100644 --- a/crates/hir_ty/src/diagnostics/expr.rs +++ b/crates/hir_ty/src/diagnostics/expr.rs | |||
@@ -83,7 +83,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
83 | if let Expr::Block { statements, tail, .. } = body_expr { | 83 | if let Expr::Block { statements, tail, .. } = body_expr { |
84 | if let Some(t) = tail { | 84 | if let Some(t) = tail { |
85 | self.validate_results_in_tail_expr(body.body_expr, *t, db); | 85 | self.validate_results_in_tail_expr(body.body_expr, *t, db); |
86 | } else if let Some(Statement::Expr(id)) = statements.last() { | 86 | } else if let Some(Statement::Expr { expr: id, .. }) = statements.last() { |
87 | self.validate_missing_tail_expr(body.body_expr, *id, db); | 87 | self.validate_missing_tail_expr(body.body_expr, *id, db); |
88 | } | 88 | } |
89 | } | 89 | } |
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index 50497eecb..9476e6297 100644 --- a/crates/hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs | |||
@@ -809,7 +809,7 @@ impl<'a> InferenceContext<'a> { | |||
809 | let ty = self.resolve_ty_as_possible(ty); | 809 | let ty = self.resolve_ty_as_possible(ty); |
810 | self.infer_pat(*pat, &ty, BindingMode::default()); | 810 | self.infer_pat(*pat, &ty, BindingMode::default()); |
811 | } | 811 | } |
812 | Statement::Expr(expr) => { | 812 | Statement::Expr { expr, .. } => { |
813 | self.infer_expr(*expr, &Expectation::none()); | 813 | self.infer_expr(*expr, &Expectation::none()); |
814 | } | 814 | } |
815 | } | 815 | } |