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)] __Nonexhaustive variant (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 the enum.
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, libcore and libbacktrace are triggered by this lint: in libbacktrace at least, the offending code is not idiomatic and is a valid example of this lint.
Example
pub enum Foo {
A,
B,
#[doc(hidden)]
C,
}
Could be written as:
#[non_exhaustive]
pub enum Foo {
A,
B,
#[doc(hidden)]
C,
}
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: