-
Couldn't load subscription status.
- Fork 13.9k
Closed
Labels
A-rustdoc-jsonArea: Rustdoc JSON backendArea: Rustdoc JSON backendT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Description
Rust now supports adding an explicit discriminant to all kinds of enum variant.
#[repr(u8)]
enum Foo {
Bar(i32) = 1,
Baz { a: i32, b: i32 } = 2,
}However we currently only report it for unit variants.
rust/src/rustdoc-json-types/lib.rs
Lines 339 to 370 in 7c99186
| pub enum Variant { | |
| /// A variant with no parentheses, and possible discriminant. | |
| /// | |
| /// ```rust | |
| /// enum Demo { | |
| /// PlainVariant, | |
| /// PlainWithDiscriminant = 1, | |
| /// } | |
| /// ``` | |
| Plain(Option<Discriminant>), | |
| /// A variant with unnamed fields. | |
| /// | |
| /// Unlike most of json, `#[doc(hidden)]` fields will be given as `None` | |
| /// instead of being omitted, because order matters. | |
| /// | |
| /// ```rust | |
| /// enum Demo { | |
| /// TupleVariant(i32), | |
| /// EmptyTupleVariant(), | |
| /// } | |
| /// ``` | |
| Tuple(Vec<Option<Id>>), | |
| /// A variant with named fields. | |
| /// | |
| /// ```rust | |
| /// enum Demo { | |
| /// StructVariant { x: i32 }, | |
| /// EmptyStructVariant {}, | |
| /// } | |
| /// ``` | |
| Struct { fields: Vec<Id>, fields_stripped: bool }, | |
| } |
But it should be for all variants.
@rustbot claim
Enselic
Metadata
Metadata
Assignees
Labels
A-rustdoc-jsonArea: Rustdoc JSON backendArea: Rustdoc JSON backendT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.