rust/tests/rustdoc-js-std/parser-ident.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

155 lines
3.6 KiB
JavaScript

const PARSED = [
{
query: "R<!>",
elems: [{
name: "r",
fullPath: ["r"],
pathWithoutLast: [],
pathLast: "r",
generics: [
{
name: "never",
fullPath: ["never"],
pathWithoutLast: [],
pathLast: "never",
generics: [],
typeFilter: 1,
},
],
typeFilter: -1,
}],
foundElems: 1,
original: "R<!>",
returned: [],
userQuery: "r<!>",
error: null,
},
{
query: "!",
elems: [{
name: "never",
fullPath: ["never"],
pathWithoutLast: [],
pathLast: "never",
generics: [],
typeFilter: 1,
}],
foundElems: 1,
original: "!",
returned: [],
userQuery: "!",
error: null,
},
{
query: "a!",
elems: [{
name: "a",
fullPath: ["a"],
pathWithoutLast: [],
pathLast: "a",
generics: [],
typeFilter: 16,
}],
foundElems: 1,
original: "a!",
returned: [],
userQuery: "a!",
error: null,
},
{
query: "a!::b",
elems: [],
foundElems: 0,
original: "a!::b",
returned: [],
userQuery: "a!::b",
error: "Cannot have associated items in macros",
},
{
query: "!<T>",
elems: [],
foundElems: 0,
original: "!<T>",
returned: [],
userQuery: "!<t>",
error: "Never type `!` does not accept generic parameters",
},
{
query: "!::b",
elems: [{
name: "!::b",
fullPath: ["never", "b"],
pathWithoutLast: ["never"],
pathLast: "b",
generics: [],
typeFilter: -1,
}],
foundElems: 1,
original: "!::b",
returned: [],
userQuery: "!::b",
error: null,
},
{
query: "b::!",
elems: [],
foundElems: 0,
original: "b::!",
returned: [],
userQuery: "b::!",
error: "Never type `!` is not associated item",
},
{
query: "!::!",
elems: [],
foundElems: 0,
original: "!::!",
returned: [],
userQuery: "!::!",
error: "Never type `!` is not associated item",
},
{
query: "b::!::c",
elems: [],
foundElems: 0,
original: "b::!::c",
returned: [],
userQuery: "b::!::c",
error: "Never type `!` is not associated item",
},
{
query: "!::b<T>",
elems: [{
name: "!::b",
fullPath: ["never", "b"],
pathWithoutLast: ["never"],
pathLast: "b",
generics: [
{
name: "t",
fullPath: ["t"],
pathWithoutLast: [],
pathLast: "t",
generics: [],
typeFilter: -1,
}
],
typeFilter: -1,
}],
foundElems: 1,
original: "!::b<T>",
returned: [],
userQuery: "!::b<t>",
error: null,
},
{
query: "a!::b!",
elems: [],
foundElems: 0,
original: "a!::b!",
returned: [],
userQuery: "a!::b!",
error: "Cannot have associated items in macros",
},
];