From 08a8de8181e606f009007475c743d4572758e160 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 25 Jul 2019 14:29:05 +0200 Subject: [PATCH] Add keywords item into the sidebar --- src/librustdoc/html/render.rs | 3 ++- src/test/rustdoc/keyword.rs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 3cd520fd4b50b..d7b8a7f1b4a0a 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -5007,7 +5007,8 @@ fn sidebar_module(fmt: &mut fmt::Formatter<'_>, _it: &clean::Item, ItemType::Enum, ItemType::Constant, ItemType::Static, ItemType::Trait, ItemType::Function, ItemType::Typedef, ItemType::Union, ItemType::Impl, ItemType::TyMethod, ItemType::Method, ItemType::StructField, ItemType::Variant, - ItemType::AssocType, ItemType::AssocConst, ItemType::ForeignType] { + ItemType::AssocType, ItemType::AssocConst, ItemType::ForeignType, + ItemType::Keyword] { if items.iter().any(|it| !it.is_stripped() && it.type_() == myty) { let (short, name) = item_ty_to_strs(&myty); sidebar.push_str(&format!("
  • {name}
  • ", diff --git a/src/test/rustdoc/keyword.rs b/src/test/rustdoc/keyword.rs index c721c024468dd..db5d115c6da74 100644 --- a/src/test/rustdoc/keyword.rs +++ b/src/test/rustdoc/keyword.rs @@ -4,6 +4,7 @@ // @has foo/index.html '//h2[@id="keywords"]' 'Keywords' // @has foo/index.html '//a[@href="keyword.match.html"]' 'match' +// @has foo/index.html '//div[@class="block items"]//a/@href' '#keywords' // @has foo/keyword.match.html '//a[@class="keyword"]' 'match' // @has foo/keyword.match.html '//span[@class="in-band"]' 'Keyword match' // @has foo/keyword.match.html '//section[@id="main"]//div[@class="docblock"]//p' 'this is a test!'