-
-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Semver implications of reordering enum variants #305
Comments
The precise output of |
Thanks for taking a look here and sorry for the late reply — I was traveling and AFK for a while. I'd love your help in sorting this out! Here's a specific case without The Implicit discriminants section of the reference defines the numeric values discriminants produce when cast to an appropriate numeric type: either The Casting section on that page has the following example: enum Enum {
Foo,
Bar,
Baz,
}
assert_eq!(0, Enum::Foo as isize);
assert_eq!(1, Enum::Bar as isize);
assert_eq!(2, Enum::Baz as isize); Reordering the variants inside the enum would break this example. If the enum is |
I believe that |
Is reordering enum variants considered semver-major, minor, or patch? It definitely could change the outcomes of use of
std::mem::discriminant()
, but some technically-might-be-breaking changes are not considered semver-major (e.g. adding a method) so I feel this isn't a clear-cut case.The API evolution RFC does not address this either.
The text was updated successfully, but these errors were encountered: