about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Barsky <me@davidbarsky.com>2024-02-01 16:06:05 -0500
committerDavid Barsky <me@davidbarsky.com>2024-02-01 16:06:05 -0500
commit0fd770613bceb1e674c911485dc98a4eb272f981 (patch)
tree10fe3b66592349932f5e4d55b5194a49e1efa28e
parent1ab1a25bbab3231215e8c060225ae2008d300f1a (diff)
downloadrust-0fd770613bceb1e674c911485dc98a4eb272f981.tar.gz
rust-0fd770613bceb1e674c911485dc98a4eb272f981.zip
internal: Move `TyBuilder::subst_for_def` into a block
-rw-r--r--crates/hir-ty/src/method_resolution.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/hir-ty/src/method_resolution.rs b/crates/hir-ty/src/method_resolution.rs
index 1c068bf684a..21e603e497f 100644
--- a/crates/hir-ty/src/method_resolution.rs
+++ b/crates/hir-ty/src/method_resolution.rs
@@ -1439,15 +1439,15 @@ fn is_valid_fn_candidate(
             _ => unreachable!(),
         };
 
-        let fn_subst = TyBuilder::subst_for_def(db, fn_id, Some(impl_subst.clone()))
-            .fill_with_inference_vars(table)
-            .build();
-
         check_that!(table.unify(&expect_self_ty, self_ty));
 
         if let Some(receiver_ty) = receiver_ty {
             check_that!(data.has_self_param());
 
+            let fn_subst = TyBuilder::subst_for_def(db, fn_id, Some(impl_subst.clone()))
+                .fill_with_inference_vars(table)
+                .build();
+
             let sig = db.callable_item_signature(fn_id.into());
             let expected_receiver =
                 sig.map(|s| s.params()[0].clone()).substitute(Interner, &fn_subst);