Remove find_map_relevant_impl
This commit is contained in:
parent
de96f3d873
commit
14678778dc
6 changed files with 168 additions and 156 deletions
|
|
@ -13,7 +13,7 @@ use rustc_hir::def::Namespace::*;
|
|||
use rustc_hir::def::{DefKind, Namespace, PerNS};
|
||||
use rustc_hir::def_id::{DefId, CRATE_DEF_ID};
|
||||
use rustc_hir::Mutability;
|
||||
use rustc_middle::ty::{fast_reject::TreatProjections, Ty, TyCtxt};
|
||||
use rustc_middle::ty::{Ty, TyCtxt};
|
||||
use rustc_middle::{bug, ty};
|
||||
use rustc_resolve::rustdoc::{has_primitive_or_keyword_docs, prepare_to_doc_link_resolution};
|
||||
use rustc_resolve::rustdoc::{strip_generics_from_path, MalformedGenerics};
|
||||
|
|
@ -772,11 +772,10 @@ fn trait_impls_for<'a>(
|
|||
module: DefId,
|
||||
) -> FxHashSet<(DefId, DefId)> {
|
||||
let tcx = cx.tcx;
|
||||
let iter = tcx.doc_link_traits_in_scope(module).iter().flat_map(|&trait_| {
|
||||
trace!("considering explicit impl for trait {:?}", trait_);
|
||||
let mut impls = FxHashSet::default();
|
||||
|
||||
// Look at each trait implementation to see if it's an impl for `did`
|
||||
tcx.find_map_relevant_impl(trait_, ty, TreatProjections::ForLookup, |impl_| {
|
||||
for &trait_ in tcx.doc_link_traits_in_scope(module) {
|
||||
tcx.for_each_relevant_impl(trait_, ty, |impl_| {
|
||||
let trait_ref = tcx.impl_trait_ref(impl_).expect("this is not an inherent impl");
|
||||
// Check if these are the same type.
|
||||
let impl_type = trait_ref.skip_binder().self_ty();
|
||||
|
|
@ -800,10 +799,13 @@ fn trait_impls_for<'a>(
|
|||
_ => false,
|
||||
};
|
||||
|
||||
if saw_impl { Some((impl_, trait_)) } else { None }
|
||||
})
|
||||
});
|
||||
iter.collect()
|
||||
if saw_impl {
|
||||
impls.insert((impl_, trait_));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
impls
|
||||
}
|
||||
|
||||
/// Check for resolve collisions between a trait and its derive.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue