diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js index 9a684694a5a5a..83d6d5d0b61d1 100644 --- a/src/librustdoc/html/static/js/search.js +++ b/src/librustdoc/html/static/js/search.js @@ -1187,7 +1187,8 @@ function initSearch(rawSearchIndex) { * * @returns string? */ - function formatResultTypeSignature(type) { + function formatResultTypeSignature(row) { + const type = row.type; if (type === null) { return null; } @@ -1268,7 +1269,8 @@ function initSearch(rawSearchIndex) { } else { push(fnType.name, fnType.highlighted); if (fnType.generics && fnType.generics.length > 0 && - (fnType.generics.some(isTransitivelyHighlighted) || fnType.implDisambiguator !== null) + (fnType.generics.some(isTransitivelyHighlighted) + || row.implDisambiguator !== null) ) { pushNotHighlighted("<"); formatTypeList(fnType.generics, ", "); @@ -1713,7 +1715,7 @@ function initSearch(rawSearchIndex) { ) { // [] matches primitive:array or primitive:slice // if it matches, then we're fine, and this is an appropriate match candidate - } else if (fnType.id !== queryElem.id) { + } else if (fnType.id !== queryElem.id || queryElem.id === null) { return false; } // If the query elem has generics, and the function doesn't, @@ -1982,7 +1984,7 @@ function initSearch(rawSearchIndex) { } } const displayTypeSignature = isType ? - formatResultTypeSignature(searchIndex[id].type) : + formatResultTypeSignature(searchIndex[id]) : null; results.set(fullId, { id: id, diff --git a/tests/rustdoc-js-std/parser-ident.js b/tests/rustdoc-js-std/parser-ident.js index f65a7ce6692b0..c8f4cd5d32005 100644 --- a/tests/rustdoc-js-std/parser-ident.js +++ b/tests/rustdoc-js-std/parser-ident.js @@ -2,7 +2,8 @@ const PARSED = [ { query: "R", elems: [{ - name: "r", + name: "R", + normalizedName: "r", fullPath: ["r"], pathWithoutLast: [], pathLast: "r", @@ -28,6 +29,7 @@ const PARSED = [ query: "!", elems: [{ name: "never", + normalizedName: "never", fullPath: ["never"], pathWithoutLast: [], pathLast: "never", @@ -44,6 +46,7 @@ const PARSED = [ query: "a!", elems: [{ name: "a", + normalizedName: "a", fullPath: ["a"], pathWithoutLast: [], pathLast: "a", @@ -78,6 +81,7 @@ const PARSED = [ query: "!::b", elems: [{ name: "!::b", + normalizedName: "!::b", fullPath: ["never", "b"], pathWithoutLast: ["never"], pathLast: "b", @@ -126,7 +130,8 @@ const PARSED = [ pathLast: "b", generics: [ { - name: "t", + name: "T", + normalizedName: "t", fullPath: ["t"], pathWithoutLast: [], pathLast: "t", diff --git a/tests/rustdoc-js-std/parser-literal.js b/tests/rustdoc-js-std/parser-literal.js index 87c06224dbf2d..4ff8038f5a3e2 100644 --- a/tests/rustdoc-js-std/parser-literal.js +++ b/tests/rustdoc-js-std/parser-literal.js @@ -2,13 +2,15 @@ const PARSED = [ { query: 'R
',
elems: [{
- name: "r",
+ name: "R",
+ normalizedName: "r",
fullPath: ["r"],
pathWithoutLast: [],
pathLast: "r",
generics: [
{
- name: "p",
+ name: "P",
+ normalizedName: "p",
fullPath: ["p"],
pathWithoutLast: [],
pathLast: "p",
diff --git a/tests/rustdoc-js-std/parser-paths.js b/tests/rustdoc-js-std/parser-paths.js
index 8d4dedf3f46c8..8524057057a86 100644
--- a/tests/rustdoc-js-std/parser-paths.js
+++ b/tests/rustdoc-js-std/parser-paths.js
@@ -2,7 +2,8 @@ const PARSED = [
{
query: 'A::B',
elems: [{
- name: "a::b",
+ name: "A::B",
+ normalizedName: "a::b",
fullPath: ["a", "b"],
pathWithoutLast: ["a"],
pathLast: "b",
@@ -19,7 +20,8 @@ const PARSED = [
query: 'A::B,C',
elems: [
{
- name: "a::b",
+ name: "A::B",
+ normalizedName: "a::b",
fullPath: ["a", "b"],
pathWithoutLast: ["a"],
pathLast: "b",
@@ -27,7 +29,8 @@ const PARSED = [
typeFilter: -1,
},
{
- name: "c",
+ name: "C",
+ normalizedName: "c",
fullPath: ["c"],
pathWithoutLast: [],
pathLast: "c",
@@ -45,13 +48,15 @@ const PARSED = [
query: 'A::B ",
returned: [{
- name: "f",
+ name: "F",
fullPath: ["f"],
pathWithoutLast: [],
pathLast: "f",
generics: [
{
- name: "p",
+ name: "P",
fullPath: ["p"],
pathWithoutLast: [],
pathLast: "p",
@@ -29,7 +29,7 @@ const PARSED = [
foundElems: 1,
original: "-> P",
returned: [{
- name: "p",
+ name: "P",
fullPath: ["p"],
pathWithoutLast: [],
pathLast: "p",
diff --git a/tests/rustdoc-js-std/parser-slice-array.js b/tests/rustdoc-js-std/parser-slice-array.js
index c22b7870dbf88..4ffee261cd448 100644
--- a/tests/rustdoc-js-std/parser-slice-array.js
+++ b/tests/rustdoc-js-std/parser-slice-array.js
@@ -30,7 +30,7 @@ const PARSED = [
pathLast: "[]",
generics: [
{
- name: "d",
+ name: "D",
fullPath: ["d"],
pathWithoutLast: [],
pathLast: "d",