Skip to content

Commit

Permalink
rustdoc: fix test case for generics that look like names
Browse files Browse the repository at this point in the history
  • Loading branch information
notriddle committed Sep 3, 2023
1 parent 89a4c7f commit 6068850
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/librustdoc/html/static/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -1983,7 +1983,8 @@ function initSearch(rawSearchIndex) {
}
elem.id = match;
}
if ((elem.id === null && parsedQuery.totalElems > 1 && elem.typeFilter === -1)
if ((elem.id === null && parsedQuery.totalElems > 1 && elem.typeFilter === -1
&& elem.generics.length === 0)
|| elem.typeFilter === TY_GENERIC) {
if (genericSymbols.has(elem.name)) {
elem.id = genericSymbols.get(elem.name);
Expand Down
4 changes: 3 additions & 1 deletion src/tools/rustdoc-js/tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ function contentToDiffLine(key, value) {
}

function shouldIgnoreField(fieldName) {
return fieldName === "query" || fieldName === "correction";
return fieldName === "query" || fieldName === "correction" ||
fieldName === "proposeCorrectionFrom" ||
fieldName === "proposeCorrectionTo";
}

// This function is only called when no matching result was found and therefore will only display
Expand Down
8 changes: 6 additions & 2 deletions tests/rustdoc-js/generics-trait.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ const EXPECTED = [
],
},
{
'query': 'Result<SomeTraiz>',
'correction': null,
'query': 'Resulx<SomeTrait>',
'in_args': [],
'returned': [],
},
{
'query': 'Result<SomeTraiz>',
'proposeCorrectionFrom': 'SomeTraiz',
'proposeCorrectionTo': 'SomeTrait',
},
{
'query': 'OtherThingxxxxxxxx',
'correction': null,
Expand Down

0 comments on commit 6068850

Please sign in to comment.