Skip to content

Commit 2868cea

Browse files
committed
Avoid populating current_module_linkable_items with noops
This changes things so that it only gets inlined items added, instead of populating it with redundant parts. This is a workaround for `libc`, which has a bunch of items that get re-exported in one place.
1 parent aeeb197 commit 2868cea

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/librustdoc/html/render/context.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,15 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
808808
if let Some(def_id) = item.def_id()
809809
&& let Some(name) = item.name
810810
{
811+
if let Some((path, item_type)) = self.cache().paths.get(&def_id)
812+
&& *item_type == item.type_()
813+
&& &path[path.len() - 1..] == &self.current[..]
814+
{
815+
// Avoid populating this list with no-ops.
816+
// If this module is already the One True Path,
817+
// that's sufficient.
818+
continue;
819+
}
811820
self.current_module_linkable_items.insert(def_id, (item.type_(), name));
812821
}
813822
}

0 commit comments

Comments
 (0)