Skip to content

Commit 875b22f

Browse files
authored
Rollup merge of #96410 - notriddle:notriddle/issue-95873, r=GuillaumeGomez
rustdoc: do not write `{{root}}` in `pub use ::foo` docs Fixes #95873
2 parents dc1f98c + c2a9a68 commit 875b22f

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/librustdoc/html/format.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use rustc_hir::def_id::DefId;
1818
use rustc_middle::ty;
1919
use rustc_middle::ty::DefIdTree;
2020
use rustc_middle::ty::TyCtxt;
21+
use rustc_span::symbol::kw;
2122
use rustc_span::{sym, Symbol};
2223
use rustc_target::spec::abi::Abi;
2324

@@ -679,7 +680,7 @@ fn resolved_path<'cx>(
679680

680681
if print_all {
681682
for seg in &path.segments[..path.segments.len() - 1] {
682-
write!(w, "{}::", seg.name)?;
683+
write!(w, "{}::", if seg.name == kw::PathRoot { "" } else { seg.name.as_str() })?;
683684
}
684685
}
685686
if w.alternate() {

src/test/rustdoc/issue-95873.rs

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// @has issue_95873/index.html "//*[@class='item-left import-item']" "pub use ::std as x;"
2+
pub use ::std as x;

0 commit comments

Comments
 (0)