Skip to content

Commit 1b19354

Browse files
committed
[WIP] Fix intra-doc links on pub re-exports
This removes the incorrect error, but doesn't show the documentation anywhere.
1 parent 1dc748f commit 1b19354

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/librustdoc/passes/collect_intra_doc_links.rs

+4
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,9 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
578578
let parent_node = if item.is_fake() {
579579
// FIXME: is this correct?
580580
None
581+
// If we're documenting the crate root itself, it has no parent. Use the root instead.
582+
} else if item.def_id.is_top_level_module() {
583+
Some(item.def_id)
581584
} else {
582585
let mut current = item.def_id;
583586
// The immediate parent might not always be a module.
@@ -589,6 +592,7 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
589592
}
590593
current = parent;
591594
} else {
595+
debug!("{:?} has no parent (kind={:?}, original was {:?})", current, self.cx.tcx.def_kind(current), item.def_id);
592596
break None;
593597
}
594598
}
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#![deny(intra_doc_link_resolution_failure)]
2+
3+
/// [std::env] [g]
4+
// @has intra_link_pub_use/index.html '//a[@href="https://doc.rust-lang.org/nightly/std/env/fn.var.html"]' "std::env"
5+
// @has - '//a[@href="../intra_link_pub_use/fn.f.html"]' "g"
6+
pub use f as g;
7+
8+
pub fn f() {}

0 commit comments

Comments
 (0)