rustdoc: add note about slice/array searches to help popup

This commit is contained in:
Michael Howell 2023-06-06 17:21:06 -07:00
parent 7a1154e159
commit d3a4cd6813
4 changed files with 22 additions and 22 deletions

View File

@ -1077,6 +1077,10 @@ function preLoadCss(cssUrl) {
<code>-&gt; vec</code> or <code>String, enum:Cow -&gt; bool</code>)", <code>-&gt; vec</code> or <code>String, enum:Cow -&gt; bool</code>)",
"You can look for items with an exact name by putting double quotes around \ "You can look for items with an exact name by putting double quotes around \
your request: <code>\"string\"</code>", your request: <code>\"string\"</code>",
"Look for functions that accept or return \
<a href=\"https://doc.rust-lang.org/std/primitive.slice.html\">slices</a> and \
<a href=\"https://doc.rust-lang.org/std/primitive.array.html\">arrays</a> by writing \
square brackets (e.g., <code>-&gt; [u8]</code> or <code>[] -&gt; Option</code>)",
"Look for items inside another one by searching for a path: <code>vec::Vec</code>", "Look for items inside another one by searching for a path: <code>vec::Vec</code>",
].map(x => "<p>" + x + "</p>").join(""); ].map(x => "<p>" + x + "</p>").join("");
const div_infos = document.createElement("div"); const div_infos = document.createElement("div");

View File

@ -1,9 +1,8 @@
// exact-match // exact-match
// https://github.com/rust-lang/rust/issues/60485#issuecomment-663900624 // https://github.com/rust-lang/rust/issues/60485#issuecomment-663900624
const QUERY = 'OsString -> String';
const EXPECTED = { const EXPECTED = {
'query': 'OsString -> String',
'others': [ 'others': [
{ 'path': 'std::ffi::OsString', 'name': 'into_string' }, { 'path': 'std::ffi::OsString', 'name': 'into_string' },
] ]

View File

@ -1,24 +1,6 @@
const QUERY = [
'[[[D, []]]',
'[[[D, []]]]',
'[] u8',
'[u8]',
'[u8,u8]',
'[u8<u8>]',
'[]',
'[>',
'[<',
'[a>',
'[a<',
'[a',
'[',
']',
'primitive:[u8]',
'macro:[u8]',
];
const PARSED = [ const PARSED = [
{ {
query: '[[[D, []]]',
elems: [], elems: [],
foundElems: 0, foundElems: 0,
original: '[[[D, []]]', original: '[[[D, []]]',
@ -27,6 +9,7 @@ const PARSED = [
error: 'Unclosed `[`', error: 'Unclosed `[`',
}, },
{ {
query: '[[[D, []]]]',
elems: [ elems: [
{ {
name: "[]", name: "[]",
@ -79,6 +62,7 @@ const PARSED = [
error: null, error: null,
}, },
{ {
query: '[] u8',
elems: [ elems: [
{ {
name: "[]", name: "[]",
@ -104,6 +88,7 @@ const PARSED = [
error: null, error: null,
}, },
{ {
query: '[u8]',
elems: [ elems: [
{ {
name: "[]", name: "[]",
@ -130,6 +115,7 @@ const PARSED = [
error: null, error: null,
}, },
{ {
query: '[u8,u8]',
elems: [ elems: [
{ {
name: "[]", name: "[]",
@ -164,6 +150,7 @@ const PARSED = [
error: null, error: null,
}, },
{ {
query: '[u8<u8>]',
elems: [ elems: [
{ {
name: "[]", name: "[]",
@ -199,6 +186,7 @@ const PARSED = [
error: null, error: null,
}, },
{ {
query: '[]',
elems: [ elems: [
{ {
name: "[]", name: "[]",
@ -216,6 +204,7 @@ const PARSED = [
error: null, error: null,
}, },
{ {
query: '[>',
elems: [], elems: [],
foundElems: 0, foundElems: 0,
original: "[>", original: "[>",
@ -224,6 +213,7 @@ const PARSED = [
error: "Unexpected `>` after `[`", error: "Unexpected `>` after `[`",
}, },
{ {
query: '[<',
elems: [], elems: [],
foundElems: 0, foundElems: 0,
original: "[<", original: "[<",
@ -232,6 +222,7 @@ const PARSED = [
error: "Found generics without a path", error: "Found generics without a path",
}, },
{ {
query: '[a>',
elems: [], elems: [],
foundElems: 0, foundElems: 0,
original: "[a>", original: "[a>",
@ -240,6 +231,7 @@ const PARSED = [
error: "Unexpected `>` after `[`", error: "Unexpected `>` after `[`",
}, },
{ {
query: '[a<',
elems: [], elems: [],
foundElems: 0, foundElems: 0,
original: "[a<", original: "[a<",
@ -248,6 +240,7 @@ const PARSED = [
error: "Unclosed `<`", error: "Unclosed `<`",
}, },
{ {
query: '[a',
elems: [], elems: [],
foundElems: 0, foundElems: 0,
original: "[a", original: "[a",
@ -256,6 +249,7 @@ const PARSED = [
error: "Unclosed `[`", error: "Unclosed `[`",
}, },
{ {
query: '[',
elems: [], elems: [],
foundElems: 0, foundElems: 0,
original: "[", original: "[",
@ -264,6 +258,7 @@ const PARSED = [
error: "Unclosed `[`", error: "Unclosed `[`",
}, },
{ {
query: ']',
elems: [], elems: [],
foundElems: 0, foundElems: 0,
original: "]", original: "]",
@ -272,6 +267,7 @@ const PARSED = [
error: "Unexpected `]`", error: "Unexpected `]`",
}, },
{ {
query: 'primitive:[u8]',
elems: [ elems: [
{ {
name: "[]", name: "[]",
@ -298,6 +294,7 @@ const PARSED = [
error: null, error: null,
}, },
{ {
query: 'macro:[u8]',
elems: [], elems: [],
foundElems: 0, foundElems: 0,
original: "macro:[u8]", original: "macro:[u8]",

View File

@ -52,7 +52,7 @@ const EXPECTED = [
], ],
}, },
{ {
'query': '[TraitDog]', 'query': '[TraitCat]',
'in_args': [ 'in_args': [
{ 'path': 'slice_array', 'name': 'gamma' }, { 'path': 'slice_array', 'name': 'gamma' },
{ 'path': 'slice_array', 'name': 'epsilon' }, { 'path': 'slice_array', 'name': 'epsilon' },