1
Fork 0

rustdoc: search by macro when query ends with !

Related to #96399
This commit is contained in:
Michael Howell 2023-02-16 15:32:38 -07:00
parent c5d1b3ea96
commit 4de9c6d491
6 changed files with 132 additions and 23 deletions

View file

@ -37,6 +37,8 @@ const QUERY = [
"mod : :",
"a!a",
"a!!",
"mod:a!",
"a!::a",
];
const PARSED = [
@ -382,4 +384,22 @@ const PARSED = [
userQuery: "a!!",
error: 'Cannot have more than one `!` in an ident',
},
{
elems: [],
foundElems: 0,
original: "mod:a!",
returned: [],
typeFilter: -1,
userQuery: "mod:a!",
error: 'Invalid search type: macro `!` and `mod` both specified',
},
{
elems: [],
foundElems: 0,
original: "a!::a",
returned: [],
typeFilter: -1,
userQuery: "a!::a",
error: 'Cannot have associated items in macros',
},
];

View file

@ -1,4 +1,4 @@
const QUERY = ['fn:foo', 'enum : foo', 'macro<f>:foo'];
const QUERY = ['fn:foo', 'enum : foo', 'macro<f>:foo', 'macro!', 'macro:mac!', 'a::mac!'];
const PARSED = [
{
@ -40,4 +40,49 @@ const PARSED = [
userQuery: "macro<f>:foo",
error: "Unexpected `:`",
},
{
elems: [{
name: "macro",
fullPath: ["macro"],
pathWithoutLast: [],
pathLast: "macro",
generics: [],
}],
foundElems: 1,
original: "macro!",
returned: [],
typeFilter: 14,
userQuery: "macro!",
error: null,
},
{
elems: [{
name: "mac",
fullPath: ["mac"],
pathWithoutLast: [],
pathLast: "mac",
generics: [],
}],
foundElems: 1,
original: "macro:mac!",
returned: [],
typeFilter: 14,
userQuery: "macro:mac!",
error: null,
},
{
elems: [{
name: "a::mac",
fullPath: ["a", "mac"],
pathWithoutLast: ["a"],
pathLast: "mac",
generics: [],
}],
foundElems: 1,
original: "a::mac!",
returned: [],
typeFilter: 14,
userQuery: "a::mac!",
error: null,
},
];

View file

@ -3,6 +3,7 @@ const QUERY = [
"!",
"a!",
"a!::b",
"!::b",
"a!::b!",
];
@ -47,47 +48,50 @@ const PARSED = [
},
{
elems: [{
name: "a!",
fullPath: ["a!"],
name: "a",
fullPath: ["a"],
pathWithoutLast: [],
pathLast: "a!",
pathLast: "a",
generics: [],
}],
foundElems: 1,
original: "a!",
returned: [],
typeFilter: -1,
typeFilter: 14,
userQuery: "a!",
error: null,
},
{
elems: [{
name: "a!::b",
fullPath: ["a!", "b"],
pathWithoutLast: ["a!"],
pathLast: "b",
generics: [],
}],
foundElems: 1,
elems: [],
foundElems: 0,
original: "a!::b",
returned: [],
typeFilter: -1,
userQuery: "a!::b",
error: null,
error: "Cannot have associated items in macros",
},
{
elems: [{
name: "a!::b!",
fullPath: ["a!", "b!"],
pathWithoutLast: ["a!"],
pathLast: "b!",
name: "!::b",
fullPath: ["!", "b"],
pathWithoutLast: ["!"],
pathLast: "b",
generics: [],
}],
foundElems: 1,
original: "!::b",
returned: [],
typeFilter: -1,
userQuery: "!::b",
error: null,
},
{
elems: [],
foundElems: 0,
original: "a!::b!",
returned: [],
typeFilter: -1,
userQuery: "a!::b!",
error: null,
error: "Cannot have associated items in macros",
},
];