diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 972c2f0e15c5e..3dc55c5556b7f 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1827,8 +1827,8 @@ impl Context { *slot.borrow_mut() = self.current.clone(); }); - let mut title = if it.is_primitive() { - // No need to include the namespace for primitive types + let mut title = if it.is_primitive() || it.is_keyword() { + // No need to include the namespace for primitive types and keywords String::new() } else { self.current.join("::") diff --git a/src/test/rustdoc/keyword.rs b/src/test/rustdoc/keyword.rs index b255ffddafac8..73a026c581be5 100644 --- a/src/test/rustdoc/keyword.rs +++ b/src/test/rustdoc/keyword.rs @@ -15,6 +15,7 @@ // @has foo/index.html '//h2[@id="keywords"]' 'Keywords' // @has foo/index.html '//a[@href="keyword.match.html"]' 'match' // @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!' // @!has foo/index.html '//a/@href' 'foo/index.html' // @!has foo/foo/index.html