-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Private enum variants #32770
Copy link
Copy link
Closed
Labels
A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyA-visibilityArea: Visibility / privacyArea: Visibility / privacy
Metadata
Metadata
Assignees
Labels
A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyA-visibilityArea: Visibility / privacyArea: Visibility / privacy
Type
Fields
Give feedbackNo fields configured for issues without a type.
https://stackoverflow.com/questions/36440021/whats-purpose-of-errorkind-nonexhaustive explains why the
std::io::ErrorKindenum has this variant:It is to force users to have a catch-all
_arm when matching on anErrorKindvalue, so that more variants can be added in the future.Clearly this is a future-proofing mechanism that is useful. There is no reason it wouldn’t be as useful in external libraries on crates.io than in the standard library. But to achieve it,
ErrorKindabuses the stability mechanism with#[unstable], which can only be used in the standard library.I’m sure this was discussed before, but a quick search did not show why we don’t allow variants of the same enum to have different privacy/visibility with
puborprivkeywords, like we do for struct fields. Given the above, should this be reconsidered?CC @aturon & lang team