-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Derive PartialOrd/Ord/Hash for bitflags structs. Implement Default for io::FilePermission #16074
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
Conversation
|
A collection of bitflags is just a string of bits, which can be lexicographically ordered. I'm not sure what meaning this has, but it's not very different from implementations of |
This should be marked as a |
@nham The only argument I can come up with for deriving ordering for bitflags is so it can be used as a key in an ordered container. And maybe that's sufficient justification. |
@alexcrichton I think I've done this now. I just needed to add @kballard I guess maybe I'm not sure what you mean by "meaning". Do you mean whether or not there's a use for this ordering (outside of enabling the type to be used in an ordered container)? I guess that's where my hangup with |
You can find more information on the breaking changes policy here, the commit message should be expanded a bit according to the details of that email. |
@nham If it were up to me, I wouldn't have defined |
In order to prevent users from having to manually implement Hash and Ord for bitflags types, this commit derives these traits automatically. This breaks code that has manually implemented any of these traits for types created by the bitflags! macro. Change this code by removing implementations of these traits. [breaking-change]
@alexcrichton Thanks. I think I'm adhering to the breaking changes policy now, but please let me know if I'm missing anything. |
I wanted to add an implementation of `Default` inside the bitflags macro, but `Default` isn't in the prelude, which means anyone who wants to use `bitflags!` needs to import it. This seems not nice, so I've just implemented for `FilePermission` instead.
I wanted to add an implementation of
Default
inside the bitflags macro, butDefault
isn't in the prelude, which means anyone who wants to usebitflags!
needs to import it. This seems not nice, so I've just implemented forFilePermission
instead.