Skip to content

Commit 00eab02

Browse files
committed
Auto merge of rust-lang#120579 - GuillaumeGomez:prevent-running-unneeded-code, r=<try>
Prevent running some code if it is already in the map I realized that a lot of duplicates were being run through this function. Might be better to prevent them from computing all the information if it's already in the cache. r? `@notriddle`
2 parents bf3c6c5 + 256bbf9 commit 00eab02

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/librustdoc/clean/inline.rs

+8
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,14 @@ pub(crate) fn load_attrs<'hir>(cx: &DocContext<'hir>, did: DefId) -> &'hir [ast:
196196
/// These names are used later on by HTML rendering to generate things like
197197
/// source links back to the original item.
198198
pub(crate) fn record_extern_fqn(cx: &mut DocContext<'_>, did: DefId, kind: ItemType) {
199+
if did.is_local() {
200+
if cx.cache.exact_paths.contains_key(&did) {
201+
return;
202+
}
203+
} else if cx.cache.external_paths.contains_key(&did) {
204+
return;
205+
}
206+
199207
let crate_name = cx.tcx.crate_name(did.krate);
200208

201209
let relative =

0 commit comments

Comments
 (0)