Skip to content

Commit e0ec9c0

Browse files
committed
rustdoc: tweak some variants omitted
Don't display `// some variants omitted` if enum is marked `#[non_exhaustive]`
1 parent 0c61c7a commit e0ec9c0

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)