Skip to content

Commit a463f43

Browse files
committed
rustdoc-search: disambiguate generics
This cleans up the Simd page. It should be sufficient, even though it can wind up showing more than necessary, but allows each item to be considered in isolation.
1 parent 8206a6c commit a463f43

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -1268,7 +1268,10 @@ function initSearch(rawSearchIndex) {
12681268
}
12691269
} else {
12701270
push(fnType.name, fnType.highlighted);
1271-
if (fnType.generics && fnType.generics.some(isTransitivelyHighlighted)) {
1271+
if (fnType.generics && fnType.generics.length > 0 &&
1272+
(fnType.generics.some(isTransitivelyHighlighted)
1273+
|| row.implDisambiguator !== null)
1274+
) {
12721275
pushNotHighlighted("<");
12731276
formatTypeList(fnType.generics, ", ");
12741277
pushNotHighlighted(">");

tests/rustdoc-js/search-method-disambiguate.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ const EXPECTED = [
1111
{
1212
'path': 'search_method_disambiguate::MyTy',
1313
'name': 'my_method',
14-
'href': '../search_method_disambiguate/struct.MyTy.html#impl-X-for-MyTy%3Cbool%3E/method.my_method'
14+
'href': '../search_method_disambiguate/struct.MyTy.html#impl-X-for-MyTy%3Cbool%3E/method.my_method',
15+
'displayTypeSignature': '*MyTy*<bool> -> *bool*',
1516
},
1617
],
1718
},
@@ -21,7 +22,8 @@ const EXPECTED = [
2122
{
2223
'path': 'search_method_disambiguate::MyTy',
2324
'name': 'my_method',
24-
'href': '../search_method_disambiguate/struct.MyTy.html#impl-X-for-MyTy%3Cu8%3E/method.my_method'
25+
'href': '../search_method_disambiguate/struct.MyTy.html#impl-X-for-MyTy%3Cu8%3E/method.my_method',
26+
'displayTypeSignature': '*MyTy*<u8> -> *u8*',
2527
},
2628
],
2729
}

0 commit comments

Comments
 (0)