rust/tests/rustdoc-js-std/parser-slice-array.js
Michael Howell 28f17d97a9 rustdoc-search: make primitives and keywords less special
The search sorting code already sorts by item type discriminant,
putting things with smaller discriminants first. There was
also a special case for sorting keywords and primitives earlier,
and this commit removes it by giving them lower discriminants.

The sorting code has another criteria where items with descriptions
appear earlier than items without, and that criteria has higher
priority than the item type. This shouldn't matter, though,
because primitives and keywords normally only appear in the
standard library, and it always gives them descriptions.
2023-11-21 13:59:26 -07:00

306 lines
8.1 KiB
JavaScript

const PARSED = [
{
query: '[[[D, []]]',
elems: [],
foundElems: 0,
original: '[[[D, []]]',
returned: [],
userQuery: '[[[d, []]]',
error: 'Unclosed `[`',
},
{
query: '[[[D, []]]]',
elems: [
{
name: "[]",
fullPath: ["[]"],
pathWithoutLast: [],
pathLast: "[]",
generics: [
{
name: "[]",
fullPath: ["[]"],
pathWithoutLast: [],
pathLast: "[]",
generics: [
{
name: "[]",
fullPath: ["[]"],
pathWithoutLast: [],
pathLast: "[]",
generics: [
{
name: "d",
fullPath: ["d"],
pathWithoutLast: [],
pathLast: "d",
generics: [],
typeFilter: -1,
},
{
name: "[]",
fullPath: ["[]"],
pathWithoutLast: [],
pathLast: "[]",
generics: [],
typeFilter: 1,
},
],
typeFilter: 1,
},
],
typeFilter: 1,
},
],
typeFilter: 1,
},
],
foundElems: 1,
original: '[[[D, []]]]',
returned: [],
userQuery: '[[[d, []]]]',
error: null,
},
{
query: '[],u8',
elems: [
{
name: "[]",
fullPath: ["[]"],
pathWithoutLast: [],
pathLast: "[]",
generics: [],
typeFilter: 1,
},
{
name: "u8",
fullPath: ["u8"],
pathWithoutLast: [],
pathLast: "u8",
generics: [],
typeFilter: -1,
},
],
foundElems: 2,
original: "[],u8",
returned: [],
userQuery: "[],u8",
error: null,
},
{
query: '[u8]',
elems: [
{
name: "[]",
fullPath: ["[]"],
pathWithoutLast: [],
pathLast: "[]",
generics: [
{
name: "u8",
fullPath: ["u8"],
pathWithoutLast: [],
pathLast: "u8",
generics: [],
typeFilter: -1,
},
],
typeFilter: 1,
},
],
foundElems: 1,
original: "[u8]",
returned: [],
userQuery: "[u8]",
error: null,
},
{
query: '[u8,u8]',
elems: [
{
name: "[]",
fullPath: ["[]"],
pathWithoutLast: [],
pathLast: "[]",
generics: [
{
name: "u8",
fullPath: ["u8"],
pathWithoutLast: [],
pathLast: "u8",
generics: [],
typeFilter: -1,
},
{
name: "u8",
fullPath: ["u8"],
pathWithoutLast: [],
pathLast: "u8",
generics: [],
typeFilter: -1,
},
],
typeFilter: 1,
},
],
foundElems: 1,
original: "[u8,u8]",
returned: [],
userQuery: "[u8,u8]",
error: null,
},
{
query: '[u8<u8>]',
elems: [
{
name: "[]",
fullPath: ["[]"],
pathWithoutLast: [],
pathLast: "[]",
generics: [
{
name: "u8",
fullPath: ["u8"],
pathWithoutLast: [],
pathLast: "u8",
generics: [
{
name: "u8",
fullPath: ["u8"],
pathWithoutLast: [],
pathLast: "u8",
generics: [],
typeFilter: -1,
},
],
typeFilter: -1,
},
],
typeFilter: 1,
},
],
foundElems: 1,
original: "[u8<u8>]",
returned: [],
userQuery: "[u8<u8>]",
error: null,
},
{
query: '[]',
elems: [
{
name: "[]",
fullPath: ["[]"],
pathWithoutLast: [],
pathLast: "[]",
generics: [],
typeFilter: 1,
},
],
foundElems: 1,
original: "[]",
returned: [],
userQuery: "[]",
error: null,
},
{
query: '[>',
elems: [],
foundElems: 0,
original: "[>",
returned: [],
userQuery: "[>",
error: "Unexpected `>` after `[`",
},
{
query: '[<',
elems: [],
foundElems: 0,
original: "[<",
returned: [],
userQuery: "[<",
error: "Found generics without a path",
},
{
query: '[a>',
elems: [],
foundElems: 0,
original: "[a>",
returned: [],
userQuery: "[a>",
error: "Unexpected `>` after `[`",
},
{
query: '[a<',
elems: [],
foundElems: 0,
original: "[a<",
returned: [],
userQuery: "[a<",
error: "Unclosed `<`",
},
{
query: '[a',
elems: [],
foundElems: 0,
original: "[a",
returned: [],
userQuery: "[a",
error: "Unclosed `[`",
},
{
query: '[',
elems: [],
foundElems: 0,
original: "[",
returned: [],
userQuery: "[",
error: "Unclosed `[`",
},
{
query: ']',
elems: [],
foundElems: 0,
original: "]",
returned: [],
userQuery: "]",
error: "Unexpected `]`",
},
{
query: 'primitive:[u8]',
elems: [
{
name: "[]",
fullPath: ["[]"],
pathWithoutLast: [],
pathLast: "[]",
generics: [
{
name: "u8",
fullPath: ["u8"],
pathWithoutLast: [],
pathLast: "u8",
generics: [],
typeFilter: -1,
},
],
typeFilter: 1,
},
],
foundElems: 1,
original: "primitive:[u8]",
returned: [],
userQuery: "primitive:[u8]",
error: null,
},
{
query: 'macro:[u8]',
elems: [],
foundElems: 0,
original: "macro:[u8]",
returned: [],
userQuery: "macro:[u8]",
error: "Invalid search type: primitive `[]` and `macro` both specified",
},
];