Skip to content

Commit 03a0402

Browse files
committed
Rollup merge of #50320 - GuillaumeGomez:fix-search-path-generation, r=QuietMisdreavus
Fix invalid path generation in rustdoc search Fixes #50311.
2 parents bab812d + a876d28 commit 03a0402

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/librustdoc/html/render.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1427,7 +1427,7 @@ impl<'a> Cache {
14271427
}
14281428
if let Some(ref item_name) = item.name {
14291429
let path = self.paths.get(&item.def_id)
1430-
.map(|p| p.0.join("::").to_string())
1430+
.map(|p| p.0[..p.0.len() - 1].join("::"))
14311431
.unwrap_or("std".to_owned());
14321432
for alias in item.attrs.lists("doc")
14331433
.filter(|a| a.check_name("alias"))

src/test/rustdoc-js/alias-2.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// ignore-order
12+
1113
const QUERY = '+';
1214

1315
const EXPECTED = {
1416
'others': [
15-
{ 'path': 'std::ops::AddAssign', 'name': 'AddAssign' },
16-
{ 'path': 'std::ops::Add', 'name': 'Add' },
17+
{ 'path': 'std::ops', 'name': 'AddAssign' },
18+
{ 'path': 'std::ops', 'name': 'Add' },
1719
],
1820
};

src/test/rustdoc-js/alias.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const QUERY = '[';
1515
const EXPECTED = {
1616
'others': [
1717
{ 'path': 'std', 'name': 'slice' },
18-
{ 'path': 'std::ops::IndexMut', 'name': 'IndexMut' },
19-
{ 'path': 'std::ops::Index', 'name': 'Index' },
18+
{ 'path': 'std::ops', 'name': 'IndexMut' },
19+
{ 'path': 'std::ops', 'name': 'Index' },
2020
],
2121
};

0 commit comments

Comments
 (0)