-
Notifications
You must be signed in to change notification settings - Fork 2k
rustdoc: synthetic_non_exhaustive lint #10550
Copy link
Copy link
Closed
Labels
C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messagesgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
Metadata
Metadata
Assignees
Labels
C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messagesgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
Type
Fields
Give feedbackNo fields configured for issues without a type.
What it does
See discussion in rust-lang/rust#108925 and rust-lang/rust#109007.
enum's which have a#[doc(hidden)]attribute are effectively#[non_exhaustive]. Sometimes a#[doc(hidden)]__Nonexhaustivevariant (dating from before#[non_exhaustive]) exists, which . Even in the absence of a explicit variant to artificially synthesize a#[non_exhaustive]attribute, code which has "hidden" variants should mark itself as non exhaustive to be explicit; they are effectively non-exhaustive.Lint Name
synthetic_non_exhaustive
Category
style
Advantage
Once again, see discussion in linked issues.
enums which have#[doc(hidden)]variants are effectively non-exhaustive and should be marked as such to give clarity to the consumer of theenum.Drawbacks
See discussion in linked issues (last time I promise).
In summary, we aren't sure about the extent to which this affects existing code and how much of that code is, in actuality, valid. For example,
libcoreandlibbacktraceare triggered by this lint: inlibbacktraceat least, the offending code is not idiomatic and is a valid example of this lint.Example
Could be written as: