diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js
index 832ac42711209..a521bf66bedd8 100644
--- a/src/librustdoc/html/static/js/search.js
+++ b/src/librustdoc/html/static/js/search.js
@@ -1433,7 +1433,7 @@ function initSearch(rawSearchIndex) {
return true;
}
} else if (unifyFunctionTypes(
- fnType.generics,
+ [...fnType.generics, ...Array.from(fnType.bindings.values()).flat() ],
queryElems,
whereClause,
mgens ? new Map(mgens) : null,
diff --git a/tests/rustdoc-js/assoc-type.js b/tests/rustdoc-js/assoc-type.js
index cc3afaa17c07d..47776656e32c2 100644
--- a/tests/rustdoc-js/assoc-type.js
+++ b/tests/rustdoc-js/assoc-type.js
@@ -19,6 +19,17 @@ const EXPECTED = [
{ 'path': 'assoc_type::my', 'name': 'other_fn' },
],
},
+ {
+ 'query': 'something',
+ 'correction': null,
+ 'others': [
+ { 'path': 'assoc_type', 'name': 'Something' },
+ ],
+ 'in_args': [
+ { 'path': 'assoc_type', 'name': 'my_fn' },
+ { 'path': 'assoc_type::my', 'name': 'other_fn' },
+ ],
+ },
// if I write an explicit binding, only it shows up
{
'query': 'iterator- -> u32',