diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-03-26 08:39:25 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-26 08:39:25 +0200 |
| commit | df25f1571635583e327414312aaf54ba4935d398 (patch) | |
| tree | 377b0ef4bf6ec0ed3f9a1cfa5cb0df5206872794 | |
| parent | 48ae1b335f91ff137f955005f015b83fa24b8044 (diff) | |
| parent | e0ec9c0b9c08677b967fb2f50978bcb4466152cd (diff) | |
| download | rust-df25f1571635583e327414312aaf54ba4935d398.tar.gz rust-df25f1571635583e327414312aaf54ba4935d398.zip | |
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`
| -rw-r--r-- | src/librustdoc/html/render/print_item.rs | 2 | ||||
| -rw-r--r-- | tests/rustdoc/issue-108925.rs | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index 579b5a9c723..674cd0d62d4 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 00000000000..88aeb3c7f75 --- /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, +} + |
