diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index 579b5a9c7231b..674cd0d62d49a 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -1234,7 +1234,7 @@ fn item_enum(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, e: &clean:: w.write_str(",\n"); } - if variants_stripped { + if variants_stripped && !it.is_non_exhaustive() { w.write_str(" // some variants omitted\n"); } if toggle { diff --git a/tests/rustdoc/issue-108925.rs b/tests/rustdoc/issue-108925.rs new file mode 100644 index 0000000000000..88aeb3c7f754d --- /dev/null +++ b/tests/rustdoc/issue-108925.rs @@ -0,0 +1,11 @@ +// @has issue_108925/enum.MyThing.html +// @has - '//code' 'Shown' +// @!has - '//code' 'NotShown' +// @!has - '//code' '// some variants omitted' +#[non_exhaustive] +pub enum MyThing { + Shown, + #[doc(hidden)] + NotShown, +} +