diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index 3ea9de381eca6..83c9526faccd9 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -1634,14 +1634,23 @@ function preLoadCss(cssUrl) { addClass(div_shortcuts, "shortcuts"); div_shortcuts.innerHTML = "

Keyboard Shortcuts

" + shortcuts + "
"; + // FIXME: Find a better way to keep this list up-to-date with search.js `itemTypes` and + // `rustdoc::formats::item_type::ItemType`. + let filters = [ + "keyword", "primitive", "mod", "externcrate", "import", "struct", "enum", "fn", "type", + "static", "trait", "impl", "tymethod", "method", "structfield", "variant", "macro", + "associatedtype", "constant", "associatedconstant", "union", "foreigntype", + "existential", "attr", "derive", "traitalias", "generic", "attribute", + ]; + filters.sort(); + filters = filters.map(f => `${f}`); + const last = filters.pop(); const infos = [ `For a full list of all search features, take a look \ here.`, "Prefix searches with a type followed by a colon (e.g., fn:) to \ restrict the search to a given item kind.", - "Accepted kinds are: fn, mod, struct, \ - enum, trait, type, macro, \ - and const.", + `Accepted kinds are: ${filters.join(", ")} and ${last}.`, "Search functions by type signature (e.g., vec -> usize or \ -> vec or String, enum:Cow -> bool)", "You can look for items with an exact name by putting double quotes around \