Skip to content

Commit 8e53edb

Browse files
Add regression test for #118195
1 parent 1c556bb commit 8e53edb

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// This is a regression test for <https://github.com/rust-lang/rust/issues/118195>.
2+
// It ensures that the "Fields" heading is not generated if no field is displayed.
3+
4+
#![crate_name = "foo"]
5+
6+
// @has 'foo/enum.Foo.html'
7+
// @has - '//*[@id="variant.A"]' 'A'
8+
// @count - '//*[@id="variant.A.fields"]' 0
9+
// @has - '//*[@id="variant.B"]' 'B'
10+
// @count - '//*[@id="variant.B.fields"]' 0
11+
// @snapshot variants - '//*[@id="main-content"]/*[@class="variants"]'
12+
13+
pub enum Foo {
14+
/// A variant with no fields
15+
A {},
16+
/// A variant with hidden fields
17+
B { #[doc(hidden)] a: u8 },
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div class="variants"><section id="variant.A" class="variant"><a href="#variant.A" class="anchor">&#167;</a><h3 class="code-header">A</h3></section><div class="docblock"><p>A variant with no fields</p>
2+
</div><section id="variant.B" class="variant"><a href="#variant.B" class="anchor">&#167;</a><h3 class="code-header">B</h3></section><div class="docblock"><p>A variant with hidden fields</p>
3+
</div></div>

0 commit comments

Comments
 (0)