Skip to content

Commit

Permalink
rustdoc-json: discard non-local inherent impls
Browse files Browse the repository at this point in the history
  • Loading branch information
its-the-shrimp committed Jul 30, 2024
1 parent 80d8270 commit 5274509
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/librustdoc/formats/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,19 +543,23 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
}
}
let impl_item = Impl { impl_item: item };
if impl_item.trait_did().map_or(true, |d| self.cache.traits.contains_key(&d)) {
let impl_def_id = impl_item.def_id();
let impl_trait_id = impl_item.trait_did();
if match impl_trait_id {
Some(d) => self.cache.traits.contains_key(&d),
None => impl_def_id.is_local(),
} {
for did in dids {
if self.impl_ids.entry(did).or_default().insert(impl_item.def_id()) {
if self.impl_ids.entry(did).or_default().insert(impl_def_id) {
self.cache
.impls
.entry(did)
.or_insert_with(Vec::new)
.push(impl_item.clone());
}
}
} else {
let trait_did = impl_item.trait_did().expect("no trait did");
self.cache.orphan_trait_impls.push((trait_did, dids, impl_item));
} else if let Some(impl_trait_id) = impl_trait_id {
self.cache.orphan_trait_impls.push((impl_trait_id, dids, impl_item));
}
None
} else {
Expand Down

0 comments on commit 5274509

Please sign in to comment.