aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/method_resolution.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2020-12-04 17:41:37 +0000
committerFlorian Diebold <[email protected]>2020-12-04 17:43:47 +0000
commite5fd550dfdc7b67e22b0889983c5698439dc0bd5 (patch)
tree60a3fa0fdd2162092c6a97f960da677150889bda /crates/hir_ty/src/method_resolution.rs
parent6943b530235df98c1ceec27d7f80a974511d3c7e (diff)
Use correct, full substs for self type in impl
Without arbitrary self types, the self type could never refer to the method type parameters, so this wasn't a problem; but with arbitrary self types, it can. This fixes the crash from #6668; but it doesn't make method resolution work for these methods.
Diffstat (limited to 'crates/hir_ty/src/method_resolution.rs')
-rw-r--r--crates/hir_ty/src/method_resolution.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs
index 5a6f0c67f..8a289f52a 100644
--- a/crates/hir_ty/src/method_resolution.rs
+++ b/crates/hir_ty/src/method_resolution.rs
@@ -720,7 +720,13 @@ fn transform_receiver_ty(
720 .push(self_ty.value.clone()) 720 .push(self_ty.value.clone())
721 .fill_with_unknown() 721 .fill_with_unknown()
722 .build(), 722 .build(),
723 AssocContainerId::ImplId(impl_id) => inherent_impl_substs(db, impl_id, &self_ty)?, 723 AssocContainerId::ImplId(impl_id) => {
724 let impl_substs = inherent_impl_substs(db, impl_id, &self_ty)?;
725 Substs::build_for_def(db, function_id)
726 .use_parent_substs(&impl_substs)
727 .fill_with_unknown()
728 .build()
729 }
724 AssocContainerId::ContainerId(_) => unreachable!(), 730 AssocContainerId::ContainerId(_) => unreachable!(),
725 }; 731 };
726 let sig = db.callable_item_signature(function_id.into()); 732 let sig = db.callable_item_signature(function_id.into());