Skip to content

Commit df25f15

Browse files
authored
Rollup merge of #109007 - Ezrashaw:tweak-some-variants-omitted, r=notriddle,GuillaumeGomez
rustdoc: skip `// some variants omitted` if enum is `#[non_exhaustive]` Fixes #108925 Never touched rustdoc before so probably not the best code. cc `@dtolnay`
2 parents 48ae1b3 + e0ec9c0 commit df25f15

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/librustdoc/html/render/print_item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1234,7 +1234,7 @@ fn item_enum(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, e: &clean::
12341234
w.write_str(",\n");
12351235
}
12361236

1237-
if variants_stripped {
1237+
if variants_stripped && !it.is_non_exhaustive() {
12381238
w.write_str(" // some variants omitted\n");
12391239
}
12401240
if toggle {

tests/rustdoc/issue-108925.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// @has issue_108925/enum.MyThing.html
2+
// @has - '//code' 'Shown'
3+
// @!has - '//code' 'NotShown'
4+
// @!has - '//code' '// some variants omitted'
5+
#[non_exhaustive]
6+
pub enum MyThing {
7+
Shown,
8+
#[doc(hidden)]
9+
NotShown,
10+
}
11+

0 commit comments

Comments
 (0)