summaryrefslogtreecommitdiffstats
path: root/src/librustdoc/passes/collect_trait_impls.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /src/librustdoc/passes/collect_trait_impls.rs
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/librustdoc/passes/collect_trait_impls.rs')
-rw-r--r--src/librustdoc/passes/collect_trait_impls.rs20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/librustdoc/passes/collect_trait_impls.rs b/src/librustdoc/passes/collect_trait_impls.rs
index ff89d4e08..a57321b58 100644
--- a/src/librustdoc/passes/collect_trait_impls.rs
+++ b/src/librustdoc/passes/collect_trait_impls.rs
@@ -36,7 +36,7 @@ pub(crate) fn collect_trait_impls(mut krate: Crate, cx: &mut DocContext<'_>) ->
let prims: FxHashSet<PrimitiveType> = local_crate.primitives(tcx).iter().map(|p| p.1).collect();
let crate_items = {
- let mut coll = ItemCollector::new();
+ let mut coll = ItemAndAliasCollector::new(&cx.cache);
cx.sess().time("collect_items_for_trait_impls", || coll.visit_crate(&krate));
coll.items
};
@@ -235,21 +235,27 @@ impl<'a, 'tcx> DocVisitor for SyntheticImplCollector<'a, 'tcx> {
}
}
-#[derive(Default)]
-struct ItemCollector {
+struct ItemAndAliasCollector<'cache> {
items: FxHashSet<ItemId>,
+ cache: &'cache Cache,
}
-impl ItemCollector {
- fn new() -> Self {
- Self::default()
+impl<'cache> ItemAndAliasCollector<'cache> {
+ fn new(cache: &'cache Cache) -> Self {
+ ItemAndAliasCollector { items: FxHashSet::default(), cache }
}
}
-impl DocVisitor for ItemCollector {
+impl<'cache> DocVisitor for ItemAndAliasCollector<'cache> {
fn visit_item(&mut self, i: &Item) {
self.items.insert(i.item_id);
+ if let TypeAliasItem(alias) = &*i.kind &&
+ let Some(did) = alias.type_.def_id(self.cache)
+ {
+ self.items.insert(ItemId::DefId(did));
+ }
+
self.visit_item_recur(i)
}
}