From 0211221e9001314d54ece16e2634d51948f3ecb3 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 2 Feb 2024 16:09:34 +0100 Subject: [PATCH] Prevent running some code if it is already in the map --- src/librustdoc/clean/inline.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index aab974ad79edd..f65c09bf0e810 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -196,6 +196,14 @@ pub(crate) fn load_attrs<'hir>(cx: &DocContext<'hir>, did: DefId) -> &'hir [ast: /// These names are used later on by HTML rendering to generate things like /// source links back to the original item. pub(crate) fn record_extern_fqn(cx: &mut DocContext<'_>, did: DefId, kind: ItemType) { + if did.is_local() { + if cx.cache.exact_paths.contains_key(&did) { + return; + } + } else if cx.cache.external_paths.contains_key(&did) { + return; + } + let crate_name = cx.tcx.crate_name(did.krate); let relative =