:foo",
returned: [],
typeFilter: 14,
diff --git a/src/test/rustdoc-js-std/parser-generics.js b/src/test/rustdoc-js-std/parser-generics.js
index d21adf767ded..34d33ed4d67a 100644
--- a/src/test/rustdoc-js-std/parser-generics.js
+++ b/src/test/rustdoc-js-std/parser-generics.js
@@ -1,9 +1,8 @@
-const QUERY = ['', 'A, E>'];
+const QUERY = ['
', 'A, E>', 'p<> u8'];
const PARSED = [
{
args: [],
- elemName: null,
elems: [{
name: "",
fullPath: [""],
@@ -20,8 +19,6 @@ const PARSED = [
],
}],
foundElems: 1,
- id: "
",
- nameSplit: null,
original: "
",
returned: [],
typeFilter: -1,
@@ -30,7 +27,6 @@ const PARSED = [
},
{
args: [],
- elemName: null,
elems: [{
name: "a",
fullPath: ["a"],
@@ -70,12 +66,35 @@ const PARSED = [
],
}],
foundElems: 1,
- id: 'A, E>',
- nameSplit: null,
original: 'A, E>',
returned: [],
typeFilter: -1,
userQuery: 'a, e>',
error: null,
- }
+ },
+ {
+ args: [],
+ elems: [
+ {
+ name: "p",
+ fullPath: ["p"],
+ pathWithoutLast: [],
+ pathLast: "p",
+ generics: [],
+ },
+ {
+ name: "u8",
+ fullPath: ["u8"],
+ pathWithoutLast: [],
+ pathLast: "u8",
+ generics: [],
+ },
+ ],
+ foundElems: 2,
+ original: "p<> u8",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "p<> u8",
+ error: null,
+ },
];
diff --git a/src/test/rustdoc-js-std/parser-in_args.js b/src/test/rustdoc-js-std/parser-in_args.js
index 88761771d9d3..e74e423ceed8 100644
--- a/src/test/rustdoc-js-std/parser-in_args.js
+++ b/src/test/rustdoc-js-std/parser-in_args.js
@@ -9,11 +9,8 @@ const PARSED = [
pathLast: "whatever",
generics: [],
}],
- elemName: null,
elems: [],
foundElems: 1,
- id: "(whatever)",
- nameSplit: null,
original: "(whatever)",
returned: [],
typeFilter: -1,
@@ -36,11 +33,8 @@ const PARSED = [
},
],
}],
- elemName: null,
elems: [],
foundElems: 1,
- id: "(
)",
- nameSplit: null,
original: "(
)",
returned: [],
typeFilter: -1,
diff --git a/src/test/rustdoc-js-std/parser-invalid.js b/src/test/rustdoc-js-std/parser-invalid.js
index b5d96e9f507c..5e7be3c73b0f 100644
--- a/src/test/rustdoc-js-std/parser-invalid.js
+++ b/src/test/rustdoc-js-std/parser-invalid.js
@@ -6,11 +6,8 @@ const QUERY = ['->
(p2)', '(p -> p2', 'a b', 'a,b(c)'];
const PARSED = [
{
args: [],
- elemName: null,
elems: [],
foundElems: 2,
- id: "->
(p2)",
- nameSplit: null,
original: "->
(p2)",
returned: [
{
@@ -57,11 +54,8 @@ const PARSED = [
generics: [],
},
],
- elemName: null,
elems: [],
foundElems: 2,
- id: "(p -> p2",
- nameSplit: null,
original: "(p -> p2",
returned: [],
typeFilter: -1,
@@ -70,7 +64,6 @@ const PARSED = [
},
{
args: [],
- elemName: null,
elems: [
{
name: "a b",
@@ -81,8 +74,6 @@ const PARSED = [
},
],
foundElems: 1,
- id: "a b",
- nameSplit: null,
original: "a b",
returned: [],
typeFilter: -1,
@@ -99,7 +90,6 @@ const PARSED = [
generics: [],
},
],
- elemName: null,
elems: [
{
name: "a",
@@ -117,8 +107,6 @@ const PARSED = [
},
],
foundElems: 3,
- id: "a,b(c)",
- nameSplit: null,
original: "a,b(c)",
returned: [],
typeFilter: -1,
diff --git a/src/test/rustdoc-js-std/parser-literal.js b/src/test/rustdoc-js-std/parser-literal.js
index f1713fbaf885..f8c736729222 100644
--- a/src/test/rustdoc-js-std/parser-literal.js
+++ b/src/test/rustdoc-js-std/parser-literal.js
@@ -3,7 +3,6 @@ const QUERY = ['R
'];
const PARSED = [
{
args: [],
- elemName: null,
elems: [{
name: "r",
fullPath: ["r"],
@@ -20,8 +19,6 @@ const PARSED = [
],
}],
foundElems: 1,
- id: "R
",
- nameSplit: null,
original: "R
",
returned: [],
typeFilter: -1,
diff --git a/src/test/rustdoc-js-std/parser-paths.js b/src/test/rustdoc-js-std/parser-paths.js
index 980a396ba7f6..1bd3bb61dc96 100644
--- a/src/test/rustdoc-js-std/parser-paths.js
+++ b/src/test/rustdoc-js-std/parser-paths.js
@@ -3,7 +3,6 @@ const QUERY = ['A::B', '::A::B', 'A::B::,C', 'A::B::,C'];
const PARSED = [
{
args: [],
- elemName: null,
elems: [{
name: "a::b",
fullPath: ["a", "b"],
@@ -12,8 +11,6 @@ const PARSED = [
generics: [],
}],
foundElems: 1,
- id: "A::B",
- nameSplit: null,
original: "A::B",
returned: [],
typeFilter: -1,
@@ -22,7 +19,6 @@ const PARSED = [
},
{
args: [],
- elemName: null,
elems: [{
name: "::a::b",
fullPath: ["a", "b"],
@@ -31,8 +27,6 @@ const PARSED = [
generics: [],
}],
foundElems: 1,
- id: '::A::B',
- nameSplit: null,
original: '::A::B',
returned: [],
typeFilter: -1,
@@ -41,7 +35,6 @@ const PARSED = [
},
{
args: [],
- elemName: null,
elems: [
{
name: "a::b::",
@@ -59,8 +52,6 @@ const PARSED = [
},
],
foundElems: 2,
- id: 'A::B::,C',
- nameSplit: null,
original: 'A::B::,C',
returned: [],
typeFilter: -1,
@@ -69,7 +60,6 @@ const PARSED = [
},
{
args: [],
- elemName: null,
elems: [
{
name: "a::b::",
@@ -95,8 +85,6 @@ const PARSED = [
},
],
foundElems: 2,
- id: 'A::B::,C',
- nameSplit: null,
original: 'A::B::,C',
returned: [],
typeFilter: -1,
diff --git a/src/test/rustdoc-js-std/parser-quote.js b/src/test/rustdoc-js-std/parser-quote.js
index 1c59a3d50ee9..07af92491726 100644
--- a/src/test/rustdoc-js-std/parser-quote.js
+++ b/src/test/rustdoc-js-std/parser-quote.js
@@ -3,11 +3,8 @@ const QUERY = ['-> "p"', '("p")'];
const PARSED = [
{
args: [],
- elemName: null,
elems: [],
foundElems: 1,
- id: "-> \"p\"",
- nameSplit: null,
original: "-> \"p\"",
returned: [{
name: "p",
@@ -28,11 +25,8 @@ const PARSED = [
pathLast: "p",
generics: [],
}],
- elemName: null,
elems: [],
foundElems: 1,
- id: "(\"p\")",
- nameSplit: null,
original: "(\"p\")",
returned: [],
typeFilter: -1,
diff --git a/src/test/rustdoc-js-std/parser-returned.js b/src/test/rustdoc-js-std/parser-returned.js
index ceecda670503..face0a7461df 100644
--- a/src/test/rustdoc-js-std/parser-returned.js
+++ b/src/test/rustdoc-js-std/parser-returned.js
@@ -3,11 +3,8 @@ const QUERY = ['-> ', '-> P'];
const PARSED = [
{
args: [],
- elemName: null,
elems: [],
foundElems: 1,
- id: "->
",
- nameSplit: null,
original: "->
",
returned: [{
name: "",
@@ -30,11 +27,8 @@ const PARSED = [
},
{
args: [],
- elemName: null,
elems: [],
foundElems: 1,
- id: "-> P",
- nameSplit: null,
original: "-> P",
returned: [{
name: "p",
diff --git a/src/test/rustdoc-js-std/vec-new.js b/src/test/rustdoc-js-std/vec-new.js
index e1a3256876bd..cd0e8e7b4a9e 100644
--- a/src/test/rustdoc-js-std/vec-new.js
+++ b/src/test/rustdoc-js-std/vec-new.js
@@ -4,6 +4,6 @@ const EXPECTED = {
'others': [
{ 'path': 'std::vec::Vec', 'name': 'new' },
{ 'path': 'std::vec::Vec', 'name': 'ne' },
- { 'path': 'std::rc::Rc', 'name': 'ne' },
+ { 'path': 'alloc::vec::Vec', 'name': 'ne' },
],
};
diff --git a/src/test/rustdoc-js/doc-alias-whitespace.js b/src/test/rustdoc-js/doc-alias-whitespace.js
index 3ee55fe455d7..c9fc0c4311f1 100644
--- a/src/test/rustdoc-js/doc-alias-whitespace.js
+++ b/src/test/rustdoc-js/doc-alias-whitespace.js
@@ -10,7 +10,7 @@ const EXPECTED = [
{
'path': 'doc_alias_whitespace',
'name': 'Struct',
- 'alias': 'demon lord',
+ 'alias': 'Demon Lord',
'href': '../doc_alias_whitespace/struct.Struct.html',
'is_alias': true
},
diff --git a/src/test/rustdoc-js/doc-alias.js b/src/test/rustdoc-js/doc-alias.js
index f450bf979818..7bb0cbe388fe 100644
--- a/src/test/rustdoc-js/doc-alias.js
+++ b/src/test/rustdoc-js/doc-alias.js
@@ -32,7 +32,7 @@ const EXPECTED = [
{
'path': 'doc_alias',
'name': 'Struct',
- 'alias': 'structitem',
+ 'alias': 'StructItem',
'href': '../doc_alias/struct.Struct.html',
'is_alias': true
},
@@ -44,7 +44,7 @@ const EXPECTED = [
{
'path': 'doc_alias::Struct',
'name': 'field',
- 'alias': 'structfielditem',
+ 'alias': 'StructFieldItem',
'href': '../doc_alias/struct.Struct.html#structfield.field',
'is_alias': true
},
@@ -56,7 +56,7 @@ const EXPECTED = [
{
'path': 'doc_alias::Struct',
'name': 'method',
- 'alias': 'structmethoditem',
+ 'alias': 'StructMethodItem',
'href': '../doc_alias/struct.Struct.html#method.method',
'is_alias': true
},
@@ -72,7 +72,7 @@ const EXPECTED = [
{
'path': 'doc_alias::Struct',
'name': 'ImplConstItem',
- 'alias': 'structimplconstitem',
+ 'alias': 'StructImplConstItem',
'href': '../doc_alias/struct.Struct.html#associatedconstant.ImplConstItem',
'is_alias': true
},
@@ -84,7 +84,7 @@ const EXPECTED = [
{
'path': 'doc_alias::Struct',
'name': 'function',
- 'alias': 'impltraitfunction',
+ 'alias': 'ImplTraitFunction',
'href': '../doc_alias/struct.Struct.html#method.function',
'is_alias': true
},
@@ -96,7 +96,7 @@ const EXPECTED = [
{
'path': 'doc_alias',
'name': 'Enum',
- 'alias': 'enumitem',
+ 'alias': 'EnumItem',
'href': '../doc_alias/enum.Enum.html',
'is_alias': true
},
@@ -108,7 +108,7 @@ const EXPECTED = [
{
'path': 'doc_alias::Enum',
'name': 'Variant',
- 'alias': 'variantitem',
+ 'alias': 'VariantItem',
'href': '../doc_alias/enum.Enum.html#variant.Variant',
'is_alias': true
},
@@ -120,7 +120,7 @@ const EXPECTED = [
{
'path': 'doc_alias::Enum',
'name': 'method',
- 'alias': 'enummethoditem',
+ 'alias': 'EnumMethodItem',
'href': '../doc_alias/enum.Enum.html#method.method',
'is_alias': true
},
@@ -132,7 +132,7 @@ const EXPECTED = [
{
'path': 'doc_alias',
'name': 'Typedef',
- 'alias': 'typedefitem',
+ 'alias': 'TypedefItem',
'href': '../doc_alias/type.Typedef.html',
'is_alias': true
},
@@ -144,7 +144,7 @@ const EXPECTED = [
{
'path': 'doc_alias',
'name': 'Trait',
- 'alias': 'traititem',
+ 'alias': 'TraitItem',
'href': '../doc_alias/trait.Trait.html',
'is_alias': true
},
@@ -156,7 +156,7 @@ const EXPECTED = [
{
'path': 'doc_alias::Trait',
'name': 'Target',
- 'alias': 'traittypeitem',
+ 'alias': 'TraitTypeItem',
'href': '../doc_alias/trait.Trait.html#associatedtype.Target',
'is_alias': true
},
@@ -168,7 +168,7 @@ const EXPECTED = [
{
'path': 'doc_alias::Trait',
'name': 'AssociatedConst',
- 'alias': 'associatedconstitem',
+ 'alias': 'AssociatedConstItem',
'href': '../doc_alias/trait.Trait.html#associatedconstant.AssociatedConst',
'is_alias': true
},
@@ -180,7 +180,7 @@ const EXPECTED = [
{
'path': 'doc_alias::Trait',
'name': 'function',
- 'alias': 'traitfunctionitem',
+ 'alias': 'TraitFunctionItem',
'href': '../doc_alias/trait.Trait.html#tymethod.function',
'is_alias': true
},
@@ -192,7 +192,7 @@ const EXPECTED = [
{
'path': 'doc_alias',
'name': 'function',
- 'alias': 'functionitem',
+ 'alias': 'FunctionItem',
'href': '../doc_alias/fn.function.html',
'is_alias': true
},
@@ -204,7 +204,7 @@ const EXPECTED = [
{
'path': 'doc_alias',
'name': 'Module',
- 'alias': 'moduleitem',
+ 'alias': 'ModuleItem',
'href': '../doc_alias/Module/index.html',
'is_alias': true
},
@@ -216,7 +216,7 @@ const EXPECTED = [
{
'path': 'doc_alias',
'name': 'Const',
- 'alias': 'constitem',
+ 'alias': 'ConstItem',
'href': '../doc_alias/constant.Const.html',
'is_alias': true
},
@@ -232,7 +232,7 @@ const EXPECTED = [
{
'path': 'doc_alias',
'name': 'Static',
- 'alias': 'staticitem',
+ 'alias': 'StaticItem',
'href': '../doc_alias/static.Static.html',
'is_alias': true
},
@@ -244,7 +244,7 @@ const EXPECTED = [
{
'path': 'doc_alias',
'name': 'Union',
- 'alias': 'unionitem',
+ 'alias': 'UnionItem',
'href': '../doc_alias/union.Union.html',
'is_alias': true
},
@@ -262,7 +262,7 @@ const EXPECTED = [
{
'path': 'doc_alias::Union',
'name': 'union_item',
- 'alias': 'unionfielditem',
+ 'alias': 'UnionFieldItem',
'href': '../doc_alias/union.Union.html#structfield.union_item',
'is_alias': true
},
@@ -274,7 +274,7 @@ const EXPECTED = [
{
'path': 'doc_alias::Union',
'name': 'method',
- 'alias': 'unionmethoditem',
+ 'alias': 'UnionMethodItem',
'href': '../doc_alias/union.Union.html#method.method',
'is_alias': true
},
@@ -286,7 +286,7 @@ const EXPECTED = [
{
'path': 'doc_alias',
'name': 'Macro',
- 'alias': 'macroitem',
+ 'alias': 'MacroItem',
'href': '../doc_alias/macro.Macro.html',
'is_alias': true
},
diff --git a/src/tools/rustdoc-js/tester.js b/src/tools/rustdoc-js/tester.js
index 5b051523ceae..4ef08f53dabc 100644
--- a/src/tools/rustdoc-js/tester.js
+++ b/src/tools/rustdoc-js/tester.js
@@ -270,7 +270,12 @@ function loadSearchJsAndIndex(searchJs, searchIndex, storageJs, crate) {
// execQuery last parameter is built in buildIndex.
// buildIndex requires the hashmap from search-index.
var functionsToLoad = ["buildHrefAndPath", "pathSplitter", "levenshtein", "validateResult",
- "buildIndex", "execQuery", "parseQuery", "createQueryResults"];
+ "buildIndex", "execQuery", "parseQuery", "createQueryResults",
+ "isWhitespace", "isSpecialStartCharacter", "isStopCharacter",
+ "removeEmptyStringsFromArray", "parseInput", "getItemsBefore",
+ "getNextElem", "createQueryElement", "isReturnArrow", "isPathStart",
+ "skipWhitespaces", "getStringElem", "itemTypeFromName",
+ "newParsedQuery"];
const functions = ["hasOwnPropertyRustdoc", "onEach"];
ALIASES = {};
@@ -286,13 +291,12 @@ function loadSearchJsAndIndex(searchJs, searchIndex, storageJs, crate) {
return [loaded, index];
}
-function checkFieldNeededFields(fullPath, expected, error_text, queryName, position) {
+// This function checks if `expected` has all the required fields needed for the checks.
+function checkNeededFields(fullPath, expected, error_text, queryName, position) {
let fieldsToCheck;
if (fullPath.length === 0) {
fieldsToCheck = [
"foundElems",
- "id",
- "nameSplit",
"original",
"returned",
"typeFilter",
@@ -328,7 +332,7 @@ function checkFieldNeededFields(fullPath, expected, error_text, queryName, posit
function valueCheck(fullPath, expected, result, error_text, queryName) {
if (Array.isArray(expected)) {
for (var i = 0; i < expected.length; ++i) {
- checkFieldNeededFields(fullPath, expected[i], error_text, queryName, i);
+ checkNeededFields(fullPath, expected[i], error_text, queryName, i);
if (i >= result.length) {
error_text.push(`${queryName}==> EXPECTED has extra value in array from field ` +
`\`${fullPath}\` (position ${i}): \`${JSON.stringify(expected[i])}\``);
@@ -367,7 +371,7 @@ function valueCheck(fullPath, expected, result, error_text, queryName) {
function runParser(query, expected, loaded, loadedFile, queryName) {
var error_text = [];
- checkFieldNeededFields("", expected, error_text, queryName, null);
+ checkNeededFields("", expected, error_text, queryName, null);
if (error_text.length === 0) {
valueCheck('', expected, loaded.parseQuery(query), error_text, queryName);
}