mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
[WIP] Fix intra-doc links on pub re-exports
This removes the incorrect error, but doesn't show the documentation anywhere.
This commit is contained in:
parent
1dc748fb3d
commit
1b1935452f
@ -578,6 +578,9 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
|
||||
let parent_node = if item.is_fake() {
|
||||
// FIXME: is this correct?
|
||||
None
|
||||
// If we're documenting the crate root itself, it has no parent. Use the root instead.
|
||||
} else if item.def_id.is_top_level_module() {
|
||||
Some(item.def_id)
|
||||
} else {
|
||||
let mut current = item.def_id;
|
||||
// The immediate parent might not always be a module.
|
||||
@ -589,6 +592,7 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
|
||||
}
|
||||
current = parent;
|
||||
} else {
|
||||
debug!("{:?} has no parent (kind={:?}, original was {:?})", current, self.cx.tcx.def_kind(current), item.def_id);
|
||||
break None;
|
||||
}
|
||||
}
|
||||
|
8
src/test/rustdoc/intra-link-pub-use.rs
Normal file
8
src/test/rustdoc/intra-link-pub-use.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![deny(intra_doc_link_resolution_failure)]
|
||||
|
||||
/// [std::env] [g]
|
||||
// @has intra_link_pub_use/index.html '//a[@href="https://doc.rust-lang.org/nightly/std/env/fn.var.html"]' "std::env"
|
||||
// @has - '//a[@href="../intra_link_pub_use/fn.f.html"]' "g"
|
||||
pub use f as g;
|
||||
|
||||
pub fn f() {}
|
Loading…
Reference in New Issue
Block a user