From e721f5e083d46853714e79c3c33eb492736cc189 Mon Sep 17 00:00:00 2001 From: QuietMisdreavus Date: Wed, 6 Mar 2019 10:16:41 -0600 Subject: [PATCH] don't process `external_traits` when collecting intra-doc links --- src/librustdoc/passes/collect_intra_doc_links.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index 67f291285c44..93e811f8b31d 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -213,6 +213,7 @@ impl<'a, 'tcx, 'rcx> LinkCollector<'a, 'tcx, 'rcx> { _ => Err(()) } } else { + debug!("attempting to resolve item without parent module: {}", path_str); Err(()) } } @@ -434,6 +435,15 @@ impl<'a, 'tcx, 'rcx> DocFolder for LinkCollector<'a, 'tcx, 'rcx> { self.fold_item_recur(item) } } + + // FIXME: if we can resolve intra-doc links from other crates, we can use the stock + // `fold_crate`, but until then we should avoid scanning `krate.external_traits` since those + // will never resolve properly + fn fold_crate(&mut self, mut c: Crate) -> Crate { + c.module = c.module.take().and_then(|module| self.fold_item(module)); + + c + } } /// Resolves a string as a macro.