Skip to content

Commit 7faaf8f

Browse files
committed
resolve: Fix resolution of empty paths passed from rustdoc
1 parent 634770c commit 7faaf8f

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

compiler/rustc_resolve/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -3298,7 +3298,9 @@ impl<'a> Resolver<'a> {
32983298
PathResult::NonModule(path_res) if path_res.unresolved_segments() == 0 => {
32993299
Some(path_res.base_res())
33003300
}
3301-
PathResult::NonModule(..) | PathResult::Failed { .. } => None,
3301+
PathResult::Module(ModuleOrUniformRoot::ExternPrelude)
3302+
| PathResult::NonModule(..)
3303+
| PathResult::Failed { .. } => None,
33023304
PathResult::Module(..) | PathResult::Indeterminate => unreachable!(),
33033305
}
33043306
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Doc link path with empty prefix that resolves to "extern prelude" instead of a module.
2+
3+
// check-pass
4+
// edition:2018
5+
6+
/// [::Unresolved]
7+
//~^ WARN unresolved link to `::Unresolved`
8+
pub struct Item;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
warning: unresolved link to `::Unresolved`
2+
--> $DIR/global-path.rs:6:6
3+
|
4+
LL | /// [::Unresolved]
5+
| ^^^^^^^^^^^^ no item named `` in scope
6+
|
7+
= note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
8+
9+
warning: 1 warning emitted
10+

0 commit comments

Comments
 (0)