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>)",
"You can look for items with an exact name by putting double quotes around \
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>",
].map(x => "<p>" + x + "</p>").join("");
const div_infos = document.createElement("div");

View File

@ -1,9 +1,8 @@
// exact-match
// https://github.com/rust-lang/rust/issues/60485#issuecomment-663900624
const QUERY = 'OsString -> String';
const EXPECTED = {
'query': 'OsString -> String',
'others': [
{ '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 = [
{
query: '[[[D, []]]',
elems: [],
foundElems: 0,
original: '[[[D, []]]',
@ -27,6 +9,7 @@ const PARSED = [
error: 'Unclosed `[`',
},
{
query: '[[[D, []]]]',
elems: [
{
name: "[]",
@ -79,6 +62,7 @@ const PARSED = [
error: null,
},
{
query: '[] u8',
elems: [
{
name: "[]",
@ -104,6 +88,7 @@ const PARSED = [
error: null,
},
{
query: '[u8]',
elems: [
{
name: "[]",
@ -130,6 +115,7 @@ const PARSED = [
error: null,
},
{
query: '[u8,u8]',
elems: [
{
name: "[]",
@ -164,6 +150,7 @@ const PARSED = [
error: null,
},
{
query: '[u8<u8>]',
elems: [
{
name: "[]",
@ -199,6 +186,7 @@ const PARSED = [
error: null,
},
{
query: '[]',
elems: [
{
name: "[]",
@ -216,6 +204,7 @@ const PARSED = [
error: null,
},
{
query: '[>',
elems: [],
foundElems: 0,
original: "[>",
@ -224,6 +213,7 @@ const PARSED = [
error: "Unexpected `>` after `[`",
},
{
query: '[<',
elems: [],
foundElems: 0,
original: "[<",
@ -232,6 +222,7 @@ const PARSED = [
error: "Found generics without a path",
},
{
query: '[a>',
elems: [],
foundElems: 0,
original: "[a>",
@ -240,6 +231,7 @@ const PARSED = [
error: "Unexpected `>` after `[`",
},
{
query: '[a<',
elems: [],
foundElems: 0,
original: "[a<",
@ -248,6 +240,7 @@ const PARSED = [
error: "Unclosed `<`",
},
{
query: '[a',
elems: [],
foundElems: 0,
original: "[a",
@ -256,6 +249,7 @@ const PARSED = [
error: "Unclosed `[`",
},
{
query: '[',
elems: [],
foundElems: 0,
original: "[",
@ -264,6 +258,7 @@ const PARSED = [
error: "Unclosed `[`",
},
{
query: ']',
elems: [],
foundElems: 0,
original: "]",
@ -272,6 +267,7 @@ const PARSED = [
error: "Unexpected `]`",
},
{
query: 'primitive:[u8]',
elems: [
{
name: "[]",
@ -298,6 +294,7 @@ const PARSED = [
error: null,
},
{
query: 'macro:[u8]',
elems: [],
foundElems: 0,
original: "macro:[u8]",

View File

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