Skip to content

Commit 6068850

Browse files
committed
rustdoc: fix test case for generics that look like names
1 parent 89a4c7f commit 6068850

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -1983,7 +1983,8 @@ function initSearch(rawSearchIndex) {
19831983
}
19841984
elem.id = match;
19851985
}
1986-
if ((elem.id === null && parsedQuery.totalElems > 1 && elem.typeFilter === -1)
1986+
if ((elem.id === null && parsedQuery.totalElems > 1 && elem.typeFilter === -1
1987+
&& elem.generics.length === 0)
19871988
|| elem.typeFilter === TY_GENERIC) {
19881989
if (genericSymbols.has(elem.name)) {
19891990
elem.id = genericSymbols.get(elem.name);

src/tools/rustdoc-js/tester.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ function contentToDiffLine(key, value) {
2323
}
2424

2525
function shouldIgnoreField(fieldName) {
26-
return fieldName === "query" || fieldName === "correction";
26+
return fieldName === "query" || fieldName === "correction" ||
27+
fieldName === "proposeCorrectionFrom" ||
28+
fieldName === "proposeCorrectionTo";
2729
}
2830

2931
// This function is only called when no matching result was found and therefore will only display

tests/rustdoc-js/generics-trait.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,15 @@ const EXPECTED = [
1212
],
1313
},
1414
{
15-
'query': 'Result<SomeTraiz>',
16-
'correction': null,
15+
'query': 'Resulx<SomeTrait>',
1716
'in_args': [],
1817
'returned': [],
1918
},
19+
{
20+
'query': 'Result<SomeTraiz>',
21+
'proposeCorrectionFrom': 'SomeTraiz',
22+
'proposeCorrectionTo': 'SomeTrait',
23+
},
2024
{
2125
'query': 'OtherThingxxxxxxxx',
2226
'correction': null,

0 commit comments

Comments
 (0)