-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Implement more traits for std::io::ErrorKind
#35911
Conversation
This makes it possible to use it as key in various maps.
(rust_highfive has picked a reviewer for you, use r? to override) |
Could you expand on the motivation of being able to use in various maps as well? One specific aspect here was to reorder the enum, and it seems like we would want to provide zero guarantees about the ordering of this enum. |
I write a tool that operates on a large number of files, and it tries to display an error summary at the end. Currently, I have an almost-exact mirror of the Do we guarantee that the ordering stays the same for types that derive ordering? I don't think that's all too useful, because we also don't want to guarantee the ordering for other enums where you can obtain it by casting it to an integer ( |
(IMO, these methods should all panic when called on |
If we're not supposed to have any guarantees about the ordering of this enum then it probably shouldn't be a C-Like enum. We're currently exposing an ordering: |
@ollie27 (that also means that this change cannot reorder fields without being a breaking change). |
@Stebalien I don't think we consider that a breaking change, see e.g. #25246 or rust-lang/rfcs#906. It doesn't realistically break any code. |
I don't really see why we'd want to reorder these variants? |
Just for consistency I guess, but I can remove that part. I thought |
To clarify, this was ment as a drive-by fix, not part of the whole pull request. I restored the old ordering because apparantly this is not a tiny change. |
@bors: r+ |
📌 Commit c2d064e has been approved by |
@bors rollup |
…crichton Implement more traits for `std::io::ErrorKind` This makes it possible to use it as key in various maps.
This makes it possible to use it as key in various maps.