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`
This commit is contained in:
Matthias Krüger 2023-03-26 08:39:25 +02:00 committed by GitHub
commit df25f15716
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -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 {

View File

@ -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,
}