diff options
| author | Ali Bektas <bektasali@protonmail.com> | 2025-01-29 00:41:10 +0100 |
|---|---|---|
| committer | Ali Bektas <bektasali@protonmail.com> | 2025-01-29 00:54:18 +0100 |
| commit | 437921fb770ed6097eb587e03f3c98a8052d839c (patch) | |
| tree | 110245dea2f64304b968c0584ac884022c18a5c8 | |
| parent | 14ab46691b77ddadbab95cff05f63dd23ca37b54 (diff) | |
| download | rust-437921fb770ed6097eb587e03f3c98a8052d839c.tar.gz rust-437921fb770ed6097eb587e03f3c98a8052d839c.zip | |
call infer_pats from infer::expr with context
| -rw-r--r-- | src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs b/src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs index f937c4fca96..a8753628afa 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs +++ b/src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs @@ -334,7 +334,7 @@ impl InferenceContext<'_> { ExprIsRead::No }; let input_ty = self.infer_expr(expr, &Expectation::none(), child_is_read); - self.infer_top_pat(pat, &input_ty); + self.infer_top_pat(pat, &input_ty, None); self.result.standard_types.bool_.clone() } Expr::Block { statements, tail, label, id } => { @@ -461,7 +461,7 @@ impl InferenceContext<'_> { // Now go through the argument patterns for (arg_pat, arg_ty) in args.iter().zip(&sig_tys) { - self.infer_top_pat(*arg_pat, arg_ty); + self.infer_top_pat(*arg_pat, arg_ty, None); } // FIXME: lift these out into a struct @@ -582,7 +582,7 @@ impl InferenceContext<'_> { let mut all_arms_diverge = Diverges::Always; for arm in arms.iter() { let input_ty = self.resolve_ty_shallow(&input_ty); - self.infer_top_pat(arm.pat, &input_ty); + self.infer_top_pat(arm.pat, &input_ty, None); } let expected = expected.adjust_for_branches(&mut self.table); @@ -927,7 +927,7 @@ impl InferenceContext<'_> { let resolver_guard = self.resolver.update_to_inner_scope(self.db.upcast(), self.owner, tgt_expr); self.inside_assignment = true; - self.infer_top_pat(target, &rhs_ty); + self.infer_top_pat(target, &rhs_ty, None); self.inside_assignment = false; self.resolver.reset_to_guard(resolver_guard); } @@ -1632,7 +1632,6 @@ impl InferenceContext<'_> { decl_ty }; - this.infer_top_pat(*pat, &ty); let decl = DeclContext { has_else: else_branch.is_some(), origin: DeclOrigin::LocalDecl, |
