Skip to content

Commit 5674092

Browse files
Rollup merge of #116475 - notriddle:notriddle/impl-trait-null, r=GuillaumeGomez
rustdoc-search: fix bug with multi-item impl trait Preview searches: - https://notriddle.com/rustdoc-html-demo-5/compiler-doc-impl-trait-bugfix/index.html?search=-%3E%20globalctxt - https://notriddle.com/rustdoc-html-demo-5/compiler-doc-impl-trait-bugfix/index.html?search=globalctxt
2 parents 9e28a93 + 1eb2a76 commit 5674092

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

src/librustdoc/html/static/js/search.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1555,7 +1555,7 @@ function initSearch(rawSearchIndex) {
15551555
return false;
15561556
}
15571557
}
1558-
} else if (fnType.id !== null) {
1558+
} else {
15591559
if (queryElem.id === typeNameIdOfArrayOrSlice &&
15601560
(fnType.id === typeNameIdOfSlice || fnType.id === typeNameIdOfArray)
15611561
) {

tests/rustdoc-js/impl-trait.js

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// exact-check
12
// ignore-order
23

34
const EXPECTED = [
@@ -20,9 +21,16 @@ const EXPECTED = [
2021
{
2122
'query': '-> Aaaaaaa',
2223
'others': [
23-
{ 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' },
24-
{ 'path': 'impl_trait::Ccccccc', 'name': 'ddddddd' },
2524
{ 'path': 'impl_trait', 'name': 'bbbbbbb' },
25+
{ 'path': 'impl_trait::Ccccccc', 'name': 'ddddddd' },
26+
{ 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' },
27+
{ 'path': 'impl_trait::Ccccccc', 'name': 'ggggggg' },
28+
],
29+
},
30+
{
31+
'query': '-> Bbbbbbb',
32+
'others': [
33+
{ 'path': 'impl_trait::Ccccccc', 'name': 'ggggggg' },
2634
],
2735
},
2836
{
@@ -31,13 +39,14 @@ const EXPECTED = [
3139
{ 'path': 'impl_trait', 'name': 'Aaaaaaa' },
3240
],
3341
'in_args': [
34-
{ 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' },
3542
{ 'path': 'impl_trait::Ccccccc', 'name': 'eeeeeee' },
43+
{ 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' },
3644
],
3745
'returned': [
38-
{ 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' },
39-
{ 'path': 'impl_trait::Ccccccc', 'name': 'ddddddd' },
4046
{ 'path': 'impl_trait', 'name': 'bbbbbbb' },
47+
{ 'path': 'impl_trait::Ccccccc', 'name': 'ddddddd' },
48+
{ 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' },
49+
{ 'path': 'impl_trait::Ccccccc', 'name': 'ggggggg' },
4150
],
4251
},
4352
];

tests/rustdoc-js/impl-trait.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
pub trait Aaaaaaa {}
22

3+
pub trait Bbbbbbb {}
4+
35
impl Aaaaaaa for () {}
6+
impl Bbbbbbb for () {}
47

58
pub fn bbbbbbb() -> impl Aaaaaaa {
69
()
@@ -18,4 +21,7 @@ impl Ccccccc {
1821
pub fn fffffff(&self, x: impl Aaaaaaa) -> impl Aaaaaaa {
1922
x
2023
}
24+
pub fn ggggggg(&self) -> impl Aaaaaaa + Bbbbbbb {
25+
()
26+
}
2127
}

0 commit comments

Comments
 (0)