diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js index 995c2e04194..a4471f1d885 100644 --- a/src/librustdoc/html/static/js/search.js +++ b/src/librustdoc/html/static/js/search.js @@ -276,7 +276,7 @@ function getFilteredNextElem(query, parserState, elems, isInGenerics) { // The type filter doesn't count as an element since it's a modifier. const typeFilterElem = elems.pop(); checkExtraTypeFilterCharacters(start, parserState); - parserState.typeFilter = typeFilterElem.name; + parserState.typeFilter = typeFilterElem.normalizedPathLast; parserState.pos += 1; parserState.totalElems -= 1; query.literalSearch = false; @@ -686,7 +686,7 @@ function createQueryElement(query, parserState, name, generics, isInGenerics) { } else if (quadcolon !== null) { throw ["Unexpected ", quadcolon[0]]; } - const pathSegments = path.split(/(?:::\s*)|(?:\s+(?:::\s*)?)/); + const pathSegments = path.split(/(?:::\s*)|(?:\s+(?:::\s*)?)/).map(x => x.toLowerCase()); // In case we only have something like `
`, there is no name. if (pathSegments.length === 0 || (pathSegments.length === 1 && pathSegments[0] === "")) { @@ -726,7 +726,10 @@ function createQueryElement(query, parserState, name, generics, isInGenerics) { if (gen.name !== null) { gen.bindingName.generics.unshift(gen); } - bindings.set(gen.bindingName.name, gen.bindingName.generics); + bindings.set( + gen.bindingName.name.toLowerCase().replace(/_/g, ""), + gen.bindingName.generics, + ); return false; } return true; @@ -1786,8 +1789,7 @@ class DocSearch { */ function newParsedQuery(userQuery) { return { - original: userQuery, - userQuery: userQuery.toLowerCase(), + userQuery, elems: [], returned: [], // Total number of "top" elements (does not include generics). @@ -1909,7 +1911,7 @@ class DocSearch { genericsElems: 0, typeFilter: null, isInBinding: null, - userQuery: userQuery.toLowerCase(), + userQuery, }; let query = newParsedQuery(userQuery); @@ -2097,7 +2099,7 @@ class DocSearch { */ const sortResults = async(results, isType, preferredCrate) => { const userQuery = parsedQuery.userQuery; - const casedUserQuery = parsedQuery.original; + const normalizedUserQuery = parsedQuery.userQuery.toLowerCase(); const result_list = []; for (const result of results.values()) { result.item = this.searchIndex[result.id]; @@ -2109,15 +2111,15 @@ class DocSearch { let a, b; // sort by exact case-sensitive match - a = (aaa.item.name !== casedUserQuery); - b = (bbb.item.name !== casedUserQuery); + a = (aaa.item.name !== userQuery); + b = (bbb.item.name !== userQuery); if (a !== b) { return a - b; } // sort by exact match with regard to the last word (mismatch goes later) - a = (aaa.word !== userQuery); - b = (bbb.word !== userQuery); + a = (aaa.word !== normalizedUserQuery); + b = (bbb.word !== normalizedUserQuery); if (a !== b) { return a - b; } @@ -3163,21 +3165,25 @@ class DocSearch { if ((elem.id === null && parsedQuery.totalElems > 1 && elem.typeFilter === -1 && elem.generics.length === 0 && elem.bindings.size === 0) || elem.typeFilter === TY_GENERIC) { - if (genericSymbols.has(elem.name)) { - elem.id = genericSymbols.get(elem.name); + if (genericSymbols.has(elem.normalizedPathLast)) { + elem.id = genericSymbols.get(elem.normalizedPathLast); } else { elem.id = -(genericSymbols.size + 1); - genericSymbols.set(elem.name, elem.id); + genericSymbols.set(elem.normalizedPathLast, elem.id); } - if (elem.typeFilter === -1 && elem.name.length >= 3) { + if (elem.typeFilter === -1 && elem.normalizedPathLast.length >= 3) { // Silly heuristic to catch if the user probably meant // to not write a generic parameter. We don't use it, // just bring it up. - const maxPartDistance = Math.floor(elem.name.length / 3); + const maxPartDistance = Math.floor(elem.normalizedPathLast.length / 3); let matchDist = maxPartDistance + 1; let matchName = ""; for (const name of this.typeNameIdMap.keys()) { - const dist = editDistance(name, elem.name, maxPartDistance); + const dist = editDistance( + name, + elem.normalizedPathLast, + maxPartDistance, + ); if (dist <= matchDist && dist <= maxPartDistance) { if (dist === matchDist && matchName > name) { continue; @@ -3289,7 +3295,7 @@ class DocSearch { 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 => { @@ -3709,11 +3715,11 @@ async function search(forced) { } // Update document title to maintain a meaningful browser history - searchState.title = "\"" + query.original + "\" Search - Rust"; + searchState.title = "\"" + query.userQuery + "\" Search - Rust"; // Because searching is incremental by character, only the most // recent search query is added to the browser history. - updateSearchHistory(buildUrl(query.original, filterCrates)); + updateSearchHistory(buildUrl(query.userQuery, filterCrates)); await showResults( await docSearch.execQuery(query, filterCrates, window.currentCrate), diff --git a/src/tools/rustdoc-js/tester.js b/src/tools/rustdoc-js/tester.js index e162ba033cc..63cda4111e6 100644 --- a/src/tools/rustdoc-js/tester.js +++ b/src/tools/rustdoc-js/tester.js @@ -84,7 +84,6 @@ function checkNeededFields(fullPath, expected, error_text, queryName, position) if (fullPath.length === 0) { fieldsToCheck = [ "foundElems", - "original", "returned", "userQuery", "error", diff --git a/tests/rustdoc-gui/search-corrections.goml b/tests/rustdoc-gui/search-corrections.goml index b81b1f382a9..f80675730c4 100644 --- a/tests/rustdoc-gui/search-corrections.goml +++ b/tests/rustdoc-gui/search-corrections.goml @@ -24,7 +24,7 @@ assert-css: (".search-corrections", { }) assert-text: ( ".search-corrections", - "Type \"notablestructwithlongnamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead." + "Type \"NotableStructWithLongNamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead." ) // Corrections do get shown on the "In Return Type" tab. @@ -35,7 +35,7 @@ assert-css: (".search-corrections", { }) assert-text: ( ".search-corrections", - "Type \"notablestructwithlongnamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead." + "Type \"NotableStructWithLongNamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead." ) // Now, explicit return values @@ -52,7 +52,7 @@ assert-css: (".search-corrections", { }) assert-text: ( ".search-corrections", - "Type \"notablestructwithlongnamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead." + "Type \"NotableStructWithLongNamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead." ) // Now, generic correction @@ -69,7 +69,7 @@ assert-css: (".search-corrections", { }) assert-text: ( ".search-corrections", - "Type \"notablestructwithlongnamr\" not found and used as generic parameter. Consider searching for \"notablestructwithlongname\" instead." + "Type \"NotableStructWithLongNamr\" not found and used as generic parameter. Consider searching for \"notablestructwithlongname\" instead." ) // Now, generic correction plus error @@ -86,7 +86,7 @@ assert-css: (".search-corrections", { }) assert-text: ( ".search-corrections", - "Type \"notablestructwithlongnamr\" not found and used as generic parameter. Consider searching for \"notablestructwithlongname\" instead." + "Type \"NotableStructWithLongNamr\" not found and used as generic parameter. Consider searching for \"notablestructwithlongname\" instead." ) go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" @@ -102,5 +102,5 @@ assert-css: (".error", { }) assert-text: ( ".error", - "Query parser error: \"Generic type parameter notablestructwithlongnamr does not accept generic parameters\"." + "Query parser error: \"Generic type parameter NotableStructWithLongNamr does not accept generic parameters\"." ) diff --git a/tests/rustdoc-js-std/parser-bindings.js b/tests/rustdoc-js-std/parser-bindings.js index c4909c6242d..bd379f139ff 100644 --- a/tests/rustdoc-js-std/parser-bindings.js +++ b/tests/rustdoc-js-std/parser-bindings.js @@ -3,20 +3,22 @@ const PARSED = [ query: 'A', elems: [ { - name: "a", + name: "A", fullPath: ["a"], pathWithoutLast: [], pathLast: "a", + normalizedPathLast: "a", generics: [], bindings: [ [ 'b', [ { - name: "c", + name: "C", fullPath: ["c"], pathWithoutLast: [], pathLast: "c", + normalizedPathLast: "c", generics: [], typeFilter: -1, }, @@ -27,16 +29,15 @@ const PARSED = [ }, ], foundElems: 1, - original: 'A', + userQuery: 'A', returned: [], - userQuery: 'a', error: null, }, { query: 'A', elems: [ { - name: "a", + name: "A", fullPath: ["a"], pathWithoutLast: [], pathLast: "a", @@ -45,7 +46,7 @@ const PARSED = [ [ 'b', [{ - name: "c", + name: "C", fullPath: ["c"], pathWithoutLast: [], pathLast: "c", @@ -58,16 +59,15 @@ const PARSED = [ }, ], foundElems: 1, - original: 'A', + userQuery: 'A', returned: [], - userQuery: 'a', error: null, }, { query: 'A', elems: [ { - name: "a", + name: "A", fullPath: ["a"], pathWithoutLast: [], pathLast: "a", @@ -89,16 +89,15 @@ const PARSED = [ }, ], foundElems: 1, - original: 'A', + userQuery: 'A', returned: [], - userQuery: 'a', error: null, }, { query: 'A', elems: [ { - name: "a", + name: "A", fullPath: ["a"], pathWithoutLast: [], pathLast: "a", @@ -120,16 +119,15 @@ const PARSED = [ }, ], foundElems: 1, - original: 'A', + userQuery: 'A', returned: [], - userQuery: 'a', error: null, }, { query: 'A', elems: [ { - name: "a", + name: "A", fullPath: ["a"], pathWithoutLast: [], pathLast: "a", @@ -160,52 +158,47 @@ const PARSED = [ }, ], foundElems: 1, - original: 'A', + userQuery: 'A', returned: [], - userQuery: 'a', error: null, }, { query: 'A', elems: [], foundElems: 0, - original: 'A', + userQuery: 'A', returned: [], - userQuery: 'a', error: "Cannot write `=` twice in a binding", }, { query: 'A', elems: [], foundElems: 0, - original: 'A', + userQuery: 'A', returned: [], - userQuery: 'a', error: "Unexpected `>` after `=`", }, { query: 'B=C', elems: [], foundElems: 0, - original: 'B=C', + userQuery: 'B=C', returned: [], - userQuery: 'b=c', error: "Type parameter `=` must be within generics list", }, { query: '[B=C]', elems: [], foundElems: 0, - original: '[B=C]', + userQuery: '[B=C]', returned: [], - userQuery: '[b=c]', error: "Type parameter `=` cannot be within slice `[]`", }, { query: 'A=C>', elems: [ { - name: "a", + name: "A", fullPath: ["a"], pathWithoutLast: [], pathLast: "a", @@ -215,7 +208,7 @@ const PARSED = [ 'b', [ { - name: "c", + name: "C", fullPath: ["c"], pathWithoutLast: [], pathLast: "c", @@ -223,7 +216,7 @@ const PARSED = [ typeFilter: -1, }, { - name: "x", + name: "X", fullPath: ["x"], pathWithoutLast: [], pathLast: "x", @@ -237,9 +230,8 @@ const PARSED = [ }, ], foundElems: 1, - original: 'A=C>', + userQuery: 'A=C>', returned: [], - userQuery: 'a=c>', error: null, }, ]; diff --git a/tests/rustdoc-js-std/parser-errors.js b/tests/rustdoc-js-std/parser-errors.js index 5ce35bf511d..068298e7236 100644 --- a/tests/rustdoc-js-std/parser-errors.js +++ b/tests/rustdoc-js-std/parser-errors.js @@ -3,450 +3,400 @@ const PARSED = [ query: '
', elems: [], foundElems: 0, - original: "
", + userQuery: "
", returned: [], - userQuery: "
", error: "Found generics without a path", }, { query: '->
', elems: [], foundElems: 0, - original: "->
", + userQuery: "->
", returned: [], - userQuery: "->
",
error: "Found generics without a path",
},
{
query: '-> *',
elems: [],
foundElems: 0,
- original: "-> *",
- returned: [],
userQuery: "-> *",
+ returned: [],
error: "Unexpected `*` after ` ` (not a valid identifier)",
},
{
query: 'a<"P">',
elems: [],
foundElems: 0,
- original: "a<\"P\">",
+ userQuery: "a<\"P\">",
returned: [],
- userQuery: "a<\"p\">",
error: "Unexpected `\"` in generics",
},
{
query: '"P" "P"',
elems: [],
foundElems: 0,
- original: "\"P\" \"P\"",
+ userQuery: "\"P\" \"P\"",
returned: [],
- userQuery: "\"p\" \"p\"",
error: "Cannot have more than one element if you use quotes",
},
{
query: '"P","P"',
elems: [],
foundElems: 0,
- original: "\"P\",\"P\"",
+ userQuery: "\"P\",\"P\"",
returned: [],
- userQuery: "\"p\",\"p\"",
error: "Cannot have more than one literal search element",
},
{
query: "P,\"P\"",
elems: [],
foundElems: 0,
- original: "P,\"P\"",
+ userQuery: "P,\"P\"",
returned: [],
- userQuery: "p,\"p\"",
error: "Cannot use literal search when there is more than one element",
},
{
query: '"p" p',
elems: [],
foundElems: 0,
- original: "\"p\" p",
- returned: [],
userQuery: "\"p\" p",
+ returned: [],
error: "Cannot have more than one element if you use quotes",
},
{
query: '"p",p',
elems: [],
foundElems: 0,
- original: "\"p\",p",
- returned: [],
userQuery: "\"p\",p",
+ returned: [],
error: "Cannot have more than one element if you use quotes",
},
{
query: '"const": p',
elems: [],
foundElems: 0,
- original: "\"const\": p",
- returned: [],
userQuery: "\"const\": p",
+ returned: [],
error: "Cannot use quotes on type filter",
},
{
query: "a<:a>",
elems: [],
foundElems: 0,
- original: "a<:a>",
- returned: [],
userQuery: "a<:a>",
+ returned: [],
error: "Expected type filter before `:`",
},
{
query: "a<::a>",
elems: [],
foundElems: 0,
- original: "a<::a>",
- returned: [],
userQuery: "a<::a>",
+ returned: [],
error: "Unexpected `::`: paths cannot start with `::`",
},
{
query: "(p -> p",
elems: [],
foundElems: 0,
- original: "(p -> p",
- returned: [],
userQuery: "(p -> p",
+ returned: [],
error: "Unclosed `(`",
},
{
query: "::a::b",
elems: [],
foundElems: 0,
- original: "::a::b",
- returned: [],
userQuery: "::a::b",
+ returned: [],
error: "Paths cannot start with `::`",
},
{
query: " ::a::b",
elems: [],
foundElems: 0,
- original: "::a::b",
- returned: [],
userQuery: "::a::b",
+ returned: [],
error: "Paths cannot start with `::`",
},
{
query: "a::::b",
elems: [],
foundElems: 0,
- original: "a::::b",
- returned: [],
userQuery: "a::::b",
+ returned: [],
error: "Unexpected `::::`",
},
{
query: "a:: ::b",
elems: [],
foundElems: 0,
- original: "a:: ::b",
- returned: [],
userQuery: "a:: ::b",
+ returned: [],
error: "Unexpected `:: ::`",
},
{
query: "a::\t::b",
elems: [],
foundElems: 0,
- original: "a:: ::b",
- returned: [],
userQuery: "a:: ::b",
+ returned: [],
error: "Unexpected `:: ::`",
},
{
query: "a::b::",
elems: [],
foundElems: 0,
- original: "a::b::",
- returned: [],
userQuery: "a::b::",
+ returned: [],
error: "Paths cannot end with `::`",
},
{
query: ":a",
elems: [],
foundElems: 0,
- original: ":a",
- returned: [],
userQuery: ":a",
+ returned: [],
error: "Expected type filter before `:`",
},
{
query: "a,b:",
elems: [],
foundElems: 0,
- original: "a,b:",
- returned: [],
userQuery: "a,b:",
+ returned: [],
error: "Unexpected `:` (expected path after type filter `b:`)",
},
{
query: "a (b:",
elems: [],
foundElems: 0,
- original: "a (b:",
- returned: [],
userQuery: "a (b:",
+ returned: [],
error: "Unclosed `(`",
},
{
query: "_:",
elems: [],
foundElems: 0,
- original: "_:",
- returned: [],
userQuery: "_:",
+ returned: [],
error: "Unexpected `_` (not a valid identifier)",
},
{
query: "ab:",
elems: [],
foundElems: 0,
- original: "ab:",
- returned: [],
userQuery: "ab:",
+ returned: [],
error: "Unexpected `:` (expected path after type filter `ab:`)",
},
{
query: "a:b",
elems: [],
foundElems: 0,
- original: "a:b",
- returned: [],
userQuery: "a:b",
+ returned: [],
error: "Unknown type filter `a`",
},
{
query: "a-bb",
elems: [],
foundElems: 0,
- original: "a-bb",
- returned: [],
userQuery: "a-bb",
+ returned: [],
error: "Unexpected `-` (did you mean `->`?)",
},
{
query: "a>bb",
elems: [],
foundElems: 0,
- original: "a>bb",
- returned: [],
userQuery: "a>bb",
+ returned: [],
error: "Unexpected `>` (did you mean `->`?)",
},
{
query: "ab'",
elems: [],
foundElems: 0,
- original: "ab'",
- returned: [],
userQuery: "ab'",
+ returned: [],
error: "Unexpected `'` after `b` (not a valid identifier)",
},
{
query: '"p" ',
elems: [],
foundElems: 0,
- original: '"p" ',
- returned: [],
userQuery: '"p" ',
+ returned: [],
error: "Cannot have more than one element if you use quotes",
},
{
query: '"p",',
elems: [],
foundElems: 0,
- original: '"p",',
- returned: [],
userQuery: '"p",',
+ returned: [],
error: "Found generics without a path",
},
{
query: '"p" a',
elems: [],
foundElems: 0,
- original: '"p" a',
- returned: [],
userQuery: '"p" a',
+ returned: [],
error: "Cannot have more than one element if you use quotes",
},
{
query: '"p",a',
elems: [],
foundElems: 0,
- original: '"p",a',
- returned: [],
userQuery: '"p",a',
+ returned: [],
error: "Cannot have more than one element if you use quotes",
},
{
query: "a,<",
elems: [],
foundElems: 0,
- original: 'a,<',
- returned: [],
userQuery: 'a,<',
+ returned: [],
error: 'Found generics without a path',
},
{
query: "aaaaa<>b",
elems: [],
foundElems: 0,
- original: 'aaaaa<>b',
- returned: [],
userQuery: 'aaaaa<>b',
+ returned: [],
error: 'Expected `,`, `:` or `->` after `>`, found `b`',
},
{
query: "fn:aaaaa<>b",
elems: [],
foundElems: 0,
- original: 'fn:aaaaa<>b',
- returned: [],
userQuery: 'fn:aaaaa<>b',
+ returned: [],
error: 'Expected `,`, `:` or `->` after `>`, found `b`',
},
{
query: "->a<>b",
elems: [],
foundElems: 0,
- original: '->a<>b',
- returned: [],
userQuery: '->a<>b',
+ returned: [],
error: 'Expected `,` or `=` after `>`, found `b`',
},
{
query: "a<->",
elems: [],
foundElems: 0,
- original: 'a<->',
- returned: [],
userQuery: 'a<->',
+ returned: [],
error: 'Unclosed `<`',
},
{
query: "a:",
elems: [],
foundElems: 0,
- original: "a:",
- returned: [],
userQuery: "a:",
+ returned: [],
error: 'Unexpected `<` in type filter (before `:`)',
},
{
query: "a<>:",
elems: [],
foundElems: 0,
- original: "a<>:",
- returned: [],
userQuery: "a<>:",
+ returned: [],
error: 'Unexpected `<` in type filter (before `:`)',
},
{
query: "a,:",
elems: [],
foundElems: 0,
- original: "a,:",
- returned: [],
userQuery: "a,:",
+ returned: [],
error: 'Expected type filter before `:`',
},
{
query: "a!:",
elems: [],
foundElems: 0,
- original: "a!:",
- returned: [],
userQuery: "a!:",
+ returned: [],
error: 'Unexpected `!` in type filter (before `:`)',
},
{
query: " a<> :",
elems: [],
foundElems: 0,
- original: "a<> :",
- returned: [],
userQuery: "a<> :",
+ returned: [],
error: 'Expected `,`, `:` or `->` after `>`, found `:`',
},
{
query: "mod : :",
elems: [],
foundElems: 0,
- original: "mod : :",
- returned: [],
userQuery: "mod : :",
+ returned: [],
error: 'Unexpected `:` (expected path after type filter `mod:`)',
},
{
query: "mod: :",
elems: [],
foundElems: 0,
- original: "mod: :",
- returned: [],
userQuery: "mod: :",
+ returned: [],
error: 'Unexpected `:` (expected path after type filter `mod:`)',
},
{
query: "a!a",
elems: [],
foundElems: 0,
- original: "a!a",
- returned: [],
userQuery: "a!a",
+ returned: [],
error: 'Unexpected `!`: it can only be at the end of an ident',
},
{
query: "a!!",
elems: [],
foundElems: 0,
- original: "a!!",
- returned: [],
userQuery: "a!!",
+ returned: [],
error: 'Cannot have more than one `!` in an ident',
},
{
query: "mod:a!",
elems: [],
foundElems: 0,
- original: "mod:a!",
- returned: [],
userQuery: "mod:a!",
+ returned: [],
error: 'Invalid search type: macro `!` and `mod` both specified',
},
{
query: "mod:!",
elems: [],
foundElems: 0,
- original: "mod:!",
- returned: [],
userQuery: "mod:!",
+ returned: [],
error: 'Invalid search type: primitive never type `!` and `mod` both specified',
},
{
query: "a!::a",
elems: [],
foundElems: 0,
- original: "a!::a",
- returned: [],
userQuery: "a!::a",
+ returned: [],
error: 'Cannot have associated items in macros',
},
{
query: "a<",
elems: [],
foundElems: 0,
- original: "a<",
- returned: [],
userQuery: "a<",
+ returned: [],
error: "Unclosed `<`",
},
{
@@ -479,9 +429,8 @@ const PARSED = [
},
],
foundElems: 2,
- original: "p )",
+ userQuery: "(-> F )",
returned: [],
- userQuery: "(-> f )",
error: null,
},
{
@@ -49,7 +48,7 @@ const PARSED = [
[
"output",
[{
- name: "p",
+ name: "P",
fullPath: ["p"],
pathWithoutLast: [],
pathLast: "p",
@@ -61,9 +60,8 @@ const PARSED = [
typeFilter: -1,
}],
foundElems: 1,
- original: "(-> P)",
+ userQuery: "(-> P)",
returned: [],
- userQuery: "(-> p)",
error: null,
},
{
@@ -90,9 +88,8 @@ const PARSED = [
typeFilter: -1,
}],
foundElems: 1,
- original: "(->,a)",
- returned: [],
userQuery: "(->,a)",
+ returned: [],
error: null,
},
{
@@ -103,13 +100,13 @@ const PARSED = [
pathWithoutLast: [],
pathLast: "->",
generics: [{
- name: "f",
+ name: "F",
fullPath: ["f"],
pathWithoutLast: [],
pathLast: "f",
generics: [
{
- name: "p",
+ name: "P",
fullPath: ["p"],
pathWithoutLast: [],
pathLast: "p",
@@ -127,9 +124,8 @@ const PARSED = [
typeFilter: -1,
}],
foundElems: 1,
- original: "(F ->)",
+ userQuery: "(F ->)",
returned: [],
- userQuery: "(f ->)",
error: null,
},
{
@@ -140,7 +136,7 @@ const PARSED = [
pathWithoutLast: [],
pathLast: "->",
generics: [{
- name: "p",
+ name: "P",
fullPath: ["p"],
pathWithoutLast: [],
pathLast: "p",
@@ -156,9 +152,8 @@ const PARSED = [
typeFilter: -1,
}],
foundElems: 1,
- original: "(P ->)",
+ userQuery: "(P ->)",
returned: [],
- userQuery: "(p ->)",
error: null,
},
{
@@ -185,9 +180,8 @@ const PARSED = [
typeFilter: -1,
}],
foundElems: 1,
- original: "(,a->)",
- returned: [],
userQuery: "(,a->)",
+ returned: [],
error: null,
},
{
@@ -221,9 +215,8 @@ const PARSED = [
typeFilter: -1,
}],
foundElems: 1,
- original: "(aaaaa->a)",
- returned: [],
userQuery: "(aaaaa->a)",
+ returned: [],
error: null,
},
{
@@ -267,9 +260,8 @@ const PARSED = [
typeFilter: -1,
}],
foundElems: 1,
- original: "(aaaaa, b -> a)",
- returned: [],
userQuery: "(aaaaa, b -> a)",
+ returned: [],
error: null,
},
{
@@ -313,9 +305,8 @@ const PARSED = [
typeFilter: 1,
}],
foundElems: 1,
- original: "primitive:(aaaaa, b -> a)",
- returned: [],
userQuery: "primitive:(aaaaa, b -> a)",
+ returned: [],
error: null,
},
{
@@ -369,16 +360,15 @@ const PARSED = [
}
],
foundElems: 2,
- original: "x, trait:(aaaaa, b -> a)",
- returned: [],
userQuery: "x, trait:(aaaaa, b -> a)",
+ returned: [],
error: null,
},
// Rust-style HOF
{
query: "Fn () -> F ",
elems: [{
- name: "fn",
+ name: "Fn",
fullPath: ["fn"],
pathWithoutLast: [],
pathLast: "fn",
@@ -387,13 +377,13 @@ const PARSED = [
[
"output",
[{
- name: "f",
+ name: "F",
fullPath: ["f"],
pathWithoutLast: [],
pathLast: "f",
generics: [
{
- name: "p",
+ name: "P",
fullPath: ["p"],
pathWithoutLast: [],
pathLast: "p",
@@ -407,15 +397,14 @@ const PARSED = [
typeFilter: -1,
}],
foundElems: 1,
- original: "Fn () -> F ",
+ userQuery: "Fn () -> F ",
returned: [],
- userQuery: "fn () -> f ",
error: null,
},
{
query: "FnMut() -> P",
elems: [{
- name: "fnmut",
+ name: "FnMut",
fullPath: ["fnmut"],
pathWithoutLast: [],
pathLast: "fnmut",
@@ -424,7 +413,7 @@ const PARSED = [
[
"output",
[{
- name: "p",
+ name: "P",
fullPath: ["p"],
pathWithoutLast: [],
pathLast: "p",
@@ -436,15 +425,14 @@ const PARSED = [
typeFilter: -1,
}],
foundElems: 1,
- original: "FnMut() -> P",
+ userQuery: "FnMut() -> P",
returned: [],
- userQuery: "fnmut() -> p",
error: null,
},
{
query: "(FnMut() -> P)",
elems: [{
- name: "fnmut",
+ name: "FnMut",
fullPath: ["fnmut"],
pathWithoutLast: [],
pathLast: "fnmut",
@@ -453,7 +441,7 @@ const PARSED = [
[
"output",
[{
- name: "p",
+ name: "P",
fullPath: ["p"],
pathWithoutLast: [],
pathLast: "p",
@@ -465,26 +453,25 @@ const PARSED = [
typeFilter: -1,
}],
foundElems: 1,
- original: "(FnMut() -> P)",
+ userQuery: "(FnMut() -> P)",
returned: [],
- userQuery: "(fnmut() -> p)",
error: null,
},
{
query: "Fn(F )",
elems: [{
- name: "fn",
+ name: "Fn",
fullPath: ["fn"],
pathWithoutLast: [],
pathLast: "fn",
generics: [{
- name: "f",
+ name: "F",
fullPath: ["f"],
pathWithoutLast: [],
pathLast: "f",
generics: [
{
- name: "p",
+ name: "P",
fullPath: ["p"],
pathWithoutLast: [],
pathLast: "p",
@@ -502,9 +489,8 @@ const PARSED = [
typeFilter: -1,
}],
foundElems: 1,
- original: "Fn(F )",
+ userQuery: "Fn(F )",
returned: [],
- userQuery: "fn(f )",
error: null,
},
{
@@ -548,9 +534,8 @@ const PARSED = [
typeFilter: 1,
}],
foundElems: 1,
- original: "primitive:fnonce(aaaaa, b) -> a",
- returned: [],
userQuery: "primitive:fnonce(aaaaa, b) -> a",
+ returned: [],
error: null,
},
{
@@ -594,9 +579,8 @@ const PARSED = [
typeFilter: 1,
}],
foundElems: 1,
- original: "primitive:fnonce(aaaaa, keyword:b) -> trait:a",
- returned: [],
userQuery: "primitive:fnonce(aaaaa, keyword:b) -> trait:a",
+ returned: [],
error: null,
},
{
@@ -665,9 +649,8 @@ const PARSED = [
}
],
foundElems: 2,
- original: "x, trait:fn(aaaaa, b -> a)",
- returned: [],
userQuery: "x, trait:fn(aaaaa, b -> a)",
+ returned: [],
error: null,
},
{
@@ -704,9 +687,8 @@ const PARSED = [
}
],
foundElems: 2,
- original: "a,b(c)",
- returned: [],
userQuery: "a,b(c)",
+ returned: [],
error: null,
},
];
diff --git a/tests/rustdoc-js-std/parser-ident.js b/tests/rustdoc-js-std/parser-ident.js
index cc79c58f1da..f65391b1571 100644
--- a/tests/rustdoc-js-std/parser-ident.js
+++ b/tests/rustdoc-js-std/parser-ident.js
@@ -2,7 +2,7 @@ const PARSED = [
{
query: "R",
elems: [{
- name: "r",
+ name: "R",
fullPath: ["r"],
pathWithoutLast: [],
pathLast: "r",
@@ -19,9 +19,8 @@ const PARSED = [
typeFilter: -1,
}],
foundElems: 1,
- original: "R",
+ userQuery: "R",
returned: [],
- userQuery: "r",
error: null,
},
{
@@ -35,9 +34,8 @@ const PARSED = [
typeFilter: 1,
}],
foundElems: 1,
- original: "!",
- returned: [],
userQuery: "!",
+ returned: [],
error: null,
},
{
@@ -51,27 +49,24 @@ const PARSED = [
typeFilter: 16,
}],
foundElems: 1,
- original: "a!",
- returned: [],
userQuery: "a!",
+ returned: [],
error: null,
},
{
query: "a!::b",
elems: [],
foundElems: 0,
- original: "a!::b",
- returned: [],
userQuery: "a!::b",
+ returned: [],
error: "Cannot have associated items in macros",
},
{
query: "! ',
elems: [{
- name: "r",
+ name: "R",
fullPath: ["r"],
pathWithoutLast: [],
pathLast: "r",
generics: [
{
- name: "p",
+ name: "P",
fullPath: ["p"],
pathWithoutLast: [],
pathLast: "p",
@@ -18,9 +18,8 @@ const PARSED = [
typeFilter: -1,
}],
foundElems: 1,
- original: "R ",
+ userQuery: "R ",
returned: [],
- userQuery: "r ",
error: null,
}
];
diff --git a/tests/rustdoc-js-std/parser-paths.js b/tests/rustdoc-js-std/parser-paths.js
index 774e5d028cc..bb34e22e518 100644
--- a/tests/rustdoc-js-std/parser-paths.js
+++ b/tests/rustdoc-js-std/parser-paths.js
@@ -2,7 +2,7 @@ const PARSED = [
{
query: 'A::B',
elems: [{
- name: "a::b",
+ name: "A::B",
fullPath: ["a", "b"],
pathWithoutLast: ["a"],
pathLast: "b",
@@ -10,9 +10,8 @@ const PARSED = [
typeFilter: -1,
}],
foundElems: 1,
- original: "A::B",
+ userQuery: "A::B",
returned: [],
- userQuery: "a::b",
error: null,
},
{
@@ -26,9 +25,8 @@ const PARSED = [
typeFilter: -1,
}],
foundElems: 1,
- original: 'a:: a',
- returned: [],
userQuery: 'a:: a',
+ returned: [],
error: null,
},
{
@@ -42,9 +40,8 @@ const PARSED = [
typeFilter: -1,
}],
foundElems: 1,
- original: 'a ::a',
- returned: [],
userQuery: 'a ::a',
+ returned: [],
error: null,
},
{
@@ -58,16 +55,15 @@ const PARSED = [
typeFilter: -1,
}],
foundElems: 1,
- original: 'a :: a',
- returned: [],
userQuery: 'a :: a',
+ returned: [],
error: null,
},
{
query: 'A::B,C',
elems: [
{
- name: "a::b",
+ name: "A::B",
fullPath: ["a", "b"],
pathWithoutLast: ["a"],
pathLast: "b",
@@ -75,7 +71,7 @@ const PARSED = [
typeFilter: -1,
},
{
- name: "c",
+ name: "C",
fullPath: ["c"],
pathWithoutLast: [],
pathLast: "c",
@@ -84,16 +80,15 @@ const PARSED = [
},
],
foundElems: 2,
- original: 'A::B,C',
+ userQuery: 'A::B,C',
returned: [],
- userQuery: 'a::b,c',
error: null,
},
{
query: 'A::B ",
elems: [],
foundElems: 1,
- original: "-> F ",
+ userQuery: "-> F ",
returned: [{
- name: "f",
+ name: "F",
fullPath: ["f"],
pathWithoutLast: [],
pathLast: "f",
generics: [
{
- name: "p",
+ name: "P",
fullPath: ["p"],
pathWithoutLast: [],
pathLast: "p",
@@ -20,30 +20,28 @@ const PARSED = [
],
typeFilter: -1,
}],
- userQuery: "-> f ",
error: null,
},
{
query: "-> P",
elems: [],
foundElems: 1,
- original: "-> P",
+ userQuery: "-> P",
returned: [{
- name: "p",
+ name: "P",
fullPath: ["p"],
pathWithoutLast: [],
pathLast: "p",
generics: [],
typeFilter: -1,
}],
- userQuery: "-> p",
error: null,
},
{
query: "->,a",
elems: [],
foundElems: 1,
- original: "->,a",
+ userQuery: "->,a",
returned: [{
name: "a",
fullPath: ["a"],
@@ -52,7 +50,6 @@ const PARSED = [
generics: [],
typeFilter: -1,
}],
- userQuery: "->,a",
error: null,
},
{
@@ -66,7 +63,7 @@ const PARSED = [
typeFilter: -1,
}],
foundElems: 2,
- original: "aaaaa->a",
+ userQuery: "aaaaa->a",
returned: [{
name: "a",
fullPath: ["a"],
@@ -75,14 +72,13 @@ const PARSED = [
generics: [],
typeFilter: -1,
}],
- userQuery: "aaaaa->a",
error: null,
},
{
query: "-> !",
elems: [],
foundElems: 1,
- original: "-> !",
+ userQuery: "-> !",
returned: [{
name: "never",
fullPath: ["never"],
@@ -91,7 +87,6 @@ const PARSED = [
generics: [],
typeFilter: 1,
}],
- userQuery: "-> !",
error: null,
},
{
@@ -105,9 +100,8 @@ const PARSED = [
typeFilter: -1,
}],
foundElems: 1,
- original: "a->",
- returned: [],
userQuery: "a->",
+ returned: [],
hasReturnArrow: true,
error: null,
},
@@ -122,9 +116,8 @@ const PARSED = [
typeFilter: 1,
}],
foundElems: 1,
- original: "!->",
- returned: [],
userQuery: "!->",
+ returned: [],
hasReturnArrow: true,
error: null,
},
@@ -139,9 +132,8 @@ const PARSED = [
typeFilter: 1,
}],
foundElems: 1,
- original: "! ->",
- returned: [],
userQuery: "! ->",
+ returned: [],
hasReturnArrow: true,
error: null,
},
@@ -156,9 +148,8 @@ const PARSED = [
typeFilter: 1,
}],
foundElems: 1,
- original: "primitive:!->",
- returned: [],
userQuery: "primitive:!->",
+ returned: [],
hasReturnArrow: true,
error: null,
},
diff --git a/tests/rustdoc-js-std/parser-separators.js b/tests/rustdoc-js-std/parser-separators.js
index 7f95f61b006..cf271c80cdc 100644
--- a/tests/rustdoc-js-std/parser-separators.js
+++ b/tests/rustdoc-js-std/parser-separators.js
@@ -14,9 +14,8 @@ const PARSED = [
},
],
foundElems: 1,
- original: "aaaaaa b",
- returned: [],
userQuery: "aaaaaa b",
+ returned: [],
error: null,
},
{
@@ -40,9 +39,8 @@ const PARSED = [
},
],
foundElems: 2,
- original: "aaaaaa, b",
- returned: [],
userQuery: "aaaaaa, b",
+ returned: [],
error: null,
},
{
@@ -58,9 +56,8 @@ const PARSED = [
},
],
foundElems: 1,
- original: "a b",
- returned: [],
userQuery: "a b",
+ returned: [],
error: null,
},
{
@@ -84,9 +81,8 @@ const PARSED = [
},
],
foundElems: 2,
- original: "a,b",
- returned: [],
userQuery: "a,b",
+ returned: [],
error: null,
},
{
@@ -102,9 +98,8 @@ const PARSED = [
},
],
foundElems: 1,
- original: "a b",
- returned: [],
userQuery: "a b",
+ returned: [],
error: null,
},
{
@@ -128,9 +123,8 @@ const PARSED = [
},
],
foundElems: 1,
- original: "a",
- returned: [],
userQuery: "a",
+ returned: [],
error: null,
},
{
@@ -161,9 +155,8 @@ const PARSED = [
},
],
foundElems: 1,
- original: "a",
- returned: [],
userQuery: "a",
+ returned: [],
error: null,
},
{
@@ -187,9 +180,8 @@ const PARSED = [
},
],
foundElems: 1,
- original: "a",
- returned: [],
userQuery: "a",
+ returned: [],
error: null,
},
];
diff --git a/tests/rustdoc-js-std/parser-slice-array.js b/tests/rustdoc-js-std/parser-slice-array.js
index 1de52af94e6..65797945535 100644
--- a/tests/rustdoc-js-std/parser-slice-array.js
+++ b/tests/rustdoc-js-std/parser-slice-array.js
@@ -3,9 +3,8 @@ const PARSED = [
query: '[[[D, []]]',
elems: [],
foundElems: 0,
- original: '[[[D, []]]',
+ userQuery: '[[[D, []]]',
returned: [],
- userQuery: '[[[d, []]]',
error: 'Unclosed `[`',
},
{
@@ -30,7 +29,7 @@ const PARSED = [
pathLast: "[]",
generics: [
{
- name: "d",
+ name: "D",
fullPath: ["d"],
pathWithoutLast: [],
pathLast: "d",
@@ -56,9 +55,8 @@ const PARSED = [
},
],
foundElems: 1,
- original: '[[[D, []]]]',
+ userQuery: '[[[D, []]]]',
returned: [],
- userQuery: '[[[d, []]]]',
error: null,
},
{
@@ -82,9 +80,8 @@ const PARSED = [
},
],
foundElems: 2,
- original: "[],u8",
- returned: [],
userQuery: "[],u8",
+ returned: [],
error: null,
},
{
@@ -109,9 +106,8 @@ const PARSED = [
},
],
foundElems: 1,
- original: "[u8]",
- returned: [],
userQuery: "[u8]",
+ returned: [],
error: null,
},
{
@@ -144,9 +140,8 @@ const PARSED = [
},
],
foundElems: 1,
- original: "[u8,u8]",
- returned: [],
userQuery: "[u8,u8]",
+ returned: [],
error: null,
},
{
@@ -180,9 +175,8 @@ const PARSED = [
},
],
foundElems: 1,
- original: "[u8