Skip to content

Commit 1452414

Browse files
authored
Rollup merge of #107242 - notriddle:notriddle/title-ordering, r=GuillaumeGomez
rustdoc: make item links consistently use `title="{shortty} {path}"` The ordering in item tables was flipped in 3030cbe, making it inconsistent with the ordering in method signatures. Compare these (before this PR is merged): https://github.com/rust-lang/rust/blob/c8e6a9e8b6251bbc8276cb78cabe1998deecbed7/src/librustdoc/html/render/print_item.rs#L455-L459 https://github.com/rust-lang/rust/blob/c8e6a9e8b6251bbc8276cb78cabe1998deecbed7/src/librustdoc/html/format.rs#L903-L908
2 parents eb5e63e + 57ca368 commit 1452414

7 files changed

+8
-8
lines changed

src/librustdoc/html/render/print_item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items:
452452
stab = stab.unwrap_or_default(),
453453
unsafety_flag = unsafety_flag,
454454
href = item_path(myitem.type_(), myitem.name.unwrap().as_str()),
455-
title = [full_path(cx, myitem), myitem.type_().to_string()]
455+
title = [myitem.type_().to_string(), full_path(cx, myitem)]
456456
.iter()
457457
.filter_map(|s| if !s.is_empty() { Some(s.as_str()) } else { None })
458458
.collect::<Vec<_>>()

tests/rustdoc-gui/unsafe-fn.goml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
44
show-text: true
55

66
compare-elements-property: (
7-
"//a[@title='test_docs::safe_fn fn']/..",
8-
"//a[@title='test_docs::unsafe_fn fn']/..",
7+
"//a[@title='fn test_docs::safe_fn']/..",
8+
"//a[@title='fn test_docs::unsafe_fn']/..",
99
["clientHeight"]
1010
)
1111

tests/rustdoc/issue-83375-multiple-mods-w-same-name-doc-inline-last-item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ pub mod sub {
1111
#[doc(inline)]
1212
pub use sub::*;
1313

14-
// @count foo/index.html '//a[@class="mod"][@title="foo::prelude mod"]' 1
14+
// @count foo/index.html '//a[@class="mod"][@title="mod foo::prelude"]' 1
1515
// @count foo/prelude/index.html '//div[@class="item-row"]' 0
1616
pub mod prelude {}

tests/rustdoc/issue-83375-multiple-mods-w-same-name-doc-inline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub mod sub {
88
}
99
}
1010

11-
// @count foo/index.html '//a[@class="mod"][@title="foo::prelude mod"]' 1
11+
// @count foo/index.html '//a[@class="mod"][@title="mod foo::prelude"]' 1
1212
// @count foo/prelude/index.html '//div[@class="item-row"]' 0
1313
pub mod prelude {}
1414

tests/rustdoc/issue-99221-multiple-structs-w-same-name.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ extern crate issue_99221_aux;
99

1010
pub use issue_99221_aux::*;
1111

12-
// @count foo/index.html '//a[@class="struct"][@title="foo::Print struct"]' 1
12+
// @count foo/index.html '//a[@class="struct"][@title="struct foo::Print"]' 1
1313

1414
pub struct Print;

tests/rustdoc/issue-99734-multiple-foreigns-w-same-name.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ extern crate issue_99734_aux;
99

1010
pub use issue_99734_aux::*;
1111

12-
// @count foo/index.html '//a[@class="fn"][@title="foo::main fn"]' 1
12+
// @count foo/index.html '//a[@class="fn"][@title="fn foo::main"]' 1
1313

1414
extern "C" {
1515
pub fn main() -> std::ffi::c_int;

tests/rustdoc/issue-99734-multiple-mods-w-same-name.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ extern crate issue_99734_aux;
99

1010
pub use issue_99734_aux::*;
1111

12-
// @count foo/index.html '//a[@class="mod"][@title="foo::task mod"]' 1
12+
// @count foo/index.html '//a[@class="mod"][@title="mod foo::task"]' 1
1313

1414
pub mod task {}

0 commit comments

Comments
 (0)