Unnamed repository; edit this file 'description' to name the repository.
internal: don't expose impl details out of hir
| -rw-r--r-- | crates/hir/src/lib.rs | 8 | ||||
| -rw-r--r-- | crates/hir_ty/src/method_resolution.rs | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 6383a467eb..544312f6fc 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -2564,7 +2564,7 @@ impl Type { krate: Crate, traits_in_scope: &FxHashSet<TraitId>, name: Option<&Name>, - mut callback: impl FnMut(&Ty, Function) -> Option<T>, + mut callback: impl FnMut(Type, Function) -> Option<T>, ) -> Option<T> { let _p = profile::span("iterate_method_candidates"); let mut slot = None; @@ -2575,7 +2575,7 @@ impl Type { name, &mut |ty, assoc_item_id| match assoc_item_id { AssocItemId::FunctionId(it) => { - slot = callback(ty, it.into()); + slot = callback(self.derived(ty.clone()), it.into()); slot.is_some() } AssocItemId::ConstId(_) | AssocItemId::TypeAliasId(_) => false, @@ -2620,7 +2620,7 @@ impl Type { krate: Crate, traits_in_scope: &FxHashSet<TraitId>, name: Option<&Name>, - mut callback: impl FnMut(&Ty, AssocItem) -> Option<T>, + mut callback: impl FnMut(Type, AssocItem) -> Option<T>, ) -> Option<T> { let _p = profile::span("iterate_path_candidates"); let mut slot = None; @@ -2630,7 +2630,7 @@ impl Type { traits_in_scope, name, &mut |ty, assoc_item_id| { - slot = callback(ty, assoc_item_id.into()); + slot = callback(self.derived(ty.clone()), assoc_item_id.into()); slot.is_some() }, ); diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs index 0bd1d30bbf..9b789b5fa2 100644 --- a/crates/hir_ty/src/method_resolution.rs +++ b/crates/hir_ty/src/method_resolution.rs @@ -410,7 +410,7 @@ pub enum LookupMode { // This would be nicer if it just returned an iterator, but that runs into // lifetime problems, because we need to borrow temp `CrateImplDefs`. // FIXME add a context type here? -pub fn iterate_method_candidates<T>( +pub fn iterate_method_candidates<T>( ty: &Canonical<Ty>, db: &dyn HirDatabase, env: Arc<TraitEnvironment>, |