diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js
index e1818dab1d5a..e565b559be8f 100644
--- a/src/librustdoc/html/static/js/search.js
+++ b/src/librustdoc/html/static/js/search.js
@@ -1572,7 +1572,9 @@ function initSearch(rawSearchIndex) {
for (const nested of fnType.generics) {
writeFn(nested, where);
}
- whereClause.set(fnParamNames[-1 - fnType.id], where);
+ if (where.length > 0) {
+ whereClause.set(fnParamNames[-1 - fnType.id], where);
+ }
} else {
if (fnType.ty === TY_PRIMITIVE) {
if (fnType.id === typeNameIdOfArray || fnType.id === typeNameIdOfSlice ||
@@ -2913,7 +2915,7 @@ function initSearch(rawSearchIndex) {
sorted_returned,
sorted_others,
parsedQuery);
- await handleAliases(ret, parsedQuery.original.replace(/"/g, ""),
+ await handleAliases(ret, parsedQuery.userQuery.replace(/"/g, ""),
filterCrates, currentCrate);
await Promise.all([ret.others, ret.returned, ret.in_args].map(async list => {
const descs = await Promise.all(list.map(result => {
diff --git a/tests/rustdoc-js-std/vec-type-signatures.js b/tests/rustdoc-js-std/vec-type-signatures.js
index 18cf9d6efd0f..4e93caf53bee 100644
--- a/tests/rustdoc-js-std/vec-type-signatures.js
+++ b/tests/rustdoc-js-std/vec-type-signatures.js
@@ -19,4 +19,16 @@ const EXPECTED = [
{ 'path': 'std::vec::IntoIter', 'name': 'next_chunk' },
],
},
+ {
+ 'query': 'vec -> Box<[T]>',
+ 'others': [
+ {
+ 'path': 'std::boxed::Box',
+ 'name': 'from',
+ 'displayType': '`Vec` -> `Box`<`[T]`, A>',
+ 'displayMappedNames': `T = T`,
+ 'displayWhereClause': 'A: `Allocator`',
+ },
+ ],
+ },
];