about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustdoc/passes/collect_intra_doc_links.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs
index 67f291285c4..93e811f8b31 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.