diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index ab341a647a820..164c504fd7fba 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -451,7 +451,7 @@ function hideThemeButtonState() {
// The element is not visible, we need to make it appear!
collapseDocs(collapses[0], "show");
}
- // In case this is a sub-variant, toggle the open.
+ // Open all ancestor to make this element visible.
openParentDetails(h3.parentNode);
}
}
diff --git a/src/test/rustdoc-gui/lib.rs b/src/test/rustdoc-gui/lib.rs
index c1e161e123588..eeba3e3f9070d 100644
--- a/src/test/rustdoc-gui/lib.rs
+++ b/src/test/rustdoc-gui/lib.rs
@@ -29,7 +29,9 @@ pub struct Foo;
impl Foo {
#[must_use]
- pub fn must_use(&self) -> bool { true }
+ pub fn must_use(&self) -> bool {
+ true
+ }
}
/// Just a normal enum.
@@ -85,3 +87,7 @@ pub trait AnotherOne {
/// let x = 12;
/// ```
pub fn check_list_code_block() {}
+
+pub enum AnEnum {
+ WithVariants { and: usize, sub: usize, variants: usize },
+}