Do not fetch HIR for reachable.
This commit is contained in:
parent
2a51e73ac9
commit
e9e12266ce
1 changed files with 16 additions and 19 deletions
|
@ -325,26 +325,23 @@ fn check_item<'tcx>(
|
|||
}
|
||||
|
||||
// We need only trait impls here, not inherent impls, and only non-exported ones
|
||||
let item = tcx.hir().item(id);
|
||||
if let hir::ItemKind::Impl(hir::Impl { of_trait: Some(ref trait_ref), ref items, .. }) =
|
||||
item.kind
|
||||
{
|
||||
if !effective_visibilities.is_reachable(item.owner_id.def_id) {
|
||||
worklist.extend(items.iter().map(|ii_ref| ii_ref.id.owner_id.def_id));
|
||||
|
||||
let Res::Def(DefKind::Trait, trait_def_id) = trait_ref.path.res else {
|
||||
unreachable!();
|
||||
};
|
||||
|
||||
if !trait_def_id.is_local() {
|
||||
return;
|
||||
}
|
||||
|
||||
worklist.extend(
|
||||
tcx.provided_trait_methods(trait_def_id).map(|assoc| assoc.def_id.expect_local()),
|
||||
);
|
||||
}
|
||||
if effective_visibilities.is_reachable(id.owner_id.def_id) {
|
||||
return;
|
||||
}
|
||||
|
||||
let items = tcx.associated_item_def_ids(id.owner_id);
|
||||
worklist.extend(items.iter().map(|ii_ref| ii_ref.expect_local()));
|
||||
|
||||
let Some(trait_def_id) = tcx.trait_id_of_impl(id.owner_id.to_def_id()) else {
|
||||
unreachable!();
|
||||
};
|
||||
|
||||
if !trait_def_id.is_local() {
|
||||
return;
|
||||
}
|
||||
|
||||
worklist
|
||||
.extend(tcx.provided_trait_methods(trait_def_id).map(|assoc| assoc.def_id.expect_local()));
|
||||
}
|
||||
|
||||
fn has_custom_linkage(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
|
||||
|
|
Loading…
Add table
Reference in a new issue