-
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
Properly handle ranges of signed enums using both extremums (fixes #49973) #49981
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add an assertion that size_of::<Option<E>>() == size_of::<E>()
. I have not read the code but the use of valid_range: min..=max
makes me slightly concerned that this may not be the case.
Or if that is too complicated to handle in this PR, please file an issue to follow up.
It is indeed not the case, which is why I didn't put a test for that. It's a known issue, though, there is a todo and whatnot in the code that some enums' valid ranges are larger than necessary. I'll file an actual issue on GH linking to it. |
Sounds good, thanks. |
r? @eddyb |
@bors r+ Do we want to backport this? |
📌 Commit a7c4b5c has been approved by |
cc @rust-lang/compiler Regarding backporting (#49981 (comment)) |
☀️ Test successful - status-appveyor, status-travis |
Fixes #49973.