rustdoc: bug fix for -> option<t>

This commit is contained in:
Michael Howell 2023-08-05 11:22:21 -07:00
parent b6bb06ca5d
commit 89a4c7f552
3 changed files with 11 additions and 1 deletions

View file

@ -37,6 +37,7 @@ let ParserState;
* args: Array<QueryElement>,
* returned: Array<QueryElement>,
* foundElems: number,
* totalElems: number,
* literalSearch: boolean,
* corrections: Array<{from: string, to: integer}>,
* }}

View file

@ -973,6 +973,8 @@ function initSearch(rawSearchIndex) {
returned: [],
// Total number of "top" elements (does not include generics).
foundElems: 0,
// Total number of elements (includes generics).
totalElems: 0,
literalSearch: false,
error: null,
correction: null,
@ -1074,6 +1076,7 @@ function initSearch(rawSearchIndex) {
query.literalSearch = parserState.totalElems > 1;
}
query.foundElems = query.elems.length + query.returned.length;
query.totalElems = parserState.totalElems;
return query;
}
@ -1980,7 +1983,7 @@ function initSearch(rawSearchIndex) {
}
elem.id = match;
}
if ((elem.id === null && parsedQuery.foundElems > 1 && elem.typeFilter === -1)
if ((elem.id === null && parsedQuery.totalElems > 1 && elem.typeFilter === -1)
|| elem.typeFilter === TY_GENERIC) {
if (genericSymbols.has(elem.name)) {
elem.id = genericSymbols.get(elem.name);

View file

@ -72,4 +72,10 @@ const EXPECTED = [
{ 'path': 'std::option::Option', 'name': 'flatten' },
],
},
{
'query': 'option<t>',
'returned': [
{ 'path': 'std::result::Result', 'name': 'ok' },
],
},
];