Skip to content

Commit 0de197d

Browse files
Update list of available search filters in help menu
1 parent ebe145e commit 0de197d

File tree

1 file changed

+12
-3
lines changed
  • src/librustdoc/html/static/js

1 file changed

+12
-3
lines changed

src/librustdoc/html/static/js/main.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,14 +1634,23 @@ function preLoadCss(cssUrl) {
16341634
addClass(div_shortcuts, "shortcuts");
16351635
div_shortcuts.innerHTML = "<h2>Keyboard Shortcuts</h2><dl>" + shortcuts + "</dl></div>";
16361636

1637+
// FIXME: Find a better way to keep this list up-to-date with search.js `itemTypes` and
1638+
// `rustdoc::formats::item_type::ItemType`.
1639+
let filters = [
1640+
"keyword", "primitive", "mod", "externcrate", "import", "struct", "enum", "fn", "type",
1641+
"static", "trait", "impl", "tymethod", "method", "structfield", "variant", "macro",
1642+
"associatedtype", "constant", "associatedconstant", "union", "foreigntype",
1643+
"existential", "attr", "derive", "traitalias", "generic", "attribute",
1644+
];
1645+
filters.sort();
1646+
filters = filters.map(f => `<code>${f}</code>`);
1647+
const last = filters.pop();
16371648
const infos = [
16381649
`For a full list of all search features, take a look \
16391650
<a href="${drloChannel}/rustdoc/read-documentation/search.html">here</a>.`,
16401651
"Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to \
16411652
restrict the search to a given item kind.",
1642-
"Accepted kinds are: <code>fn</code>, <code>mod</code>, <code>struct</code>, \
1643-
<code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, \
1644-
and <code>const</code>.",
1653+
`Accepted kinds are: ${filters.join(', ')} and ${last}.`,
16451654
"Search functions by type signature (e.g., <code>vec -&gt; usize</code> or \
16461655
<code>-&gt; vec</code> or <code>String, enum:Cow -&gt; bool</code>)",
16471656
"You can look for items with an exact name by putting double quotes around \

0 commit comments

Comments
 (0)