internal: don't expose impl details out of hir

This commit is contained in:
Aleksey Kladov 2021-08-29 18:55:25 +03:00
parent 76b60efbfb
commit cfa3f679e9
2 changed files with 5 additions and 5 deletions

View file

@ -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()
},
);

View file

@ -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>,