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:
commit
df25f15716
@ -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 {
|
||||
|
11
tests/rustdoc/issue-108925.rs
Normal file
11
tests/rustdoc/issue-108925.rs
Normal 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,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user