Rollup merge of #95681 - petrochenkov:doclinkregr2, r=Dylan-DPC
resolve: Fix resolution of empty paths passed from rustdoc Fixes https://github.com/rust-lang/rust/pull/95337#issuecomment-1088426179
This commit is contained in:
commit
728f2636ac
3 changed files with 21 additions and 1 deletions
|
@ -3298,7 +3298,9 @@ impl<'a> Resolver<'a> {
|
||||||
PathResult::NonModule(path_res) if path_res.unresolved_segments() == 0 => {
|
PathResult::NonModule(path_res) if path_res.unresolved_segments() == 0 => {
|
||||||
Some(path_res.base_res())
|
Some(path_res.base_res())
|
||||||
}
|
}
|
||||||
PathResult::NonModule(..) | PathResult::Failed { .. } => None,
|
PathResult::Module(ModuleOrUniformRoot::ExternPrelude)
|
||||||
|
| PathResult::NonModule(..)
|
||||||
|
| PathResult::Failed { .. } => None,
|
||||||
PathResult::Module(..) | PathResult::Indeterminate => unreachable!(),
|
PathResult::Module(..) | PathResult::Indeterminate => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
8
src/test/rustdoc-ui/intra-doc/global-path.rs
Normal file
8
src/test/rustdoc-ui/intra-doc/global-path.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
// Doc link path with empty prefix that resolves to "extern prelude" instead of a module.
|
||||||
|
|
||||||
|
// check-pass
|
||||||
|
// edition:2018
|
||||||
|
|
||||||
|
/// [::Unresolved]
|
||||||
|
//~^ WARN unresolved link to `::Unresolved`
|
||||||
|
pub struct Item;
|
10
src/test/rustdoc-ui/intra-doc/global-path.stderr
Normal file
10
src/test/rustdoc-ui/intra-doc/global-path.stderr
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
warning: unresolved link to `::Unresolved`
|
||||||
|
--> $DIR/global-path.rs:6:6
|
||||||
|
|
|
||||||
|
LL | /// [::Unresolved]
|
||||||
|
| ^^^^^^^^^^^^ no item named `` in scope
|
||||||
|
|
|
||||||
|
= note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
|
||||||
|
|
||||||
|
warning: 1 warning emitted
|
||||||
|
|
Loading…
Add table
Reference in a new issue