-
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
stabilize int_error_matching
#76455
stabilize int_error_matching
#76455
Conversation
r? @KodrAus (rust_highfive has picked a reviewer for you, use r? to override) |
I definitely don’t think we should call the variant In general though I think this is a useful stabilization! I’ll kick off the FCP and add my concern for underflow to let others weigh in. @rfcbot fcp merge |
Team member @KodrAus has proposed to merge this. The next step is review by the rest of the tagged team members: Concerns:
Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
@rfcbot concern underflow vs negative overflow See #76455 (comment) I think we should use an accurate name for the negative overflow variant, rather than repurposing the term underflow, which has a specific meaning for floating point numbers. |
I've always used the term "underflow" for ints wrapping beyond their lower bound and didn't realize this was not common usage. |
I actually didn’t even know underflow had a special meaning and used it the same way until I think I got assigned a docs PR once to use overflow for integers that would exceed their upper or lower bound. It turns out underflow specifically refers to floating point numbers that are too close to zero to distinguish from it. |
☔ The latest upstream changes (presumably #76804) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:
|
This was discussed on the users forum: link. |
I will open a new PR soon addressing these issues rather than continuing this one. I will also need to take a good look at the parsing code to ensure it produces the correct errors. As I am rather busy right now I will have an update within the next few weeks. |
Thanks for working through all this @ethanboxx! If you don't need to make many changes then we could probably continue on this PR, since it's already got its FCP going. |
Closing in favour of #77640 |
…t_2, r=KodrAus Refactor IntErrorKind to avoid "underflow" terminology This PR is a continuation of rust-lang#76455 # Changes - `Overflow` renamed to `PosOverflow` and `Underflow` renamed to `NegOverflow` after discussion in rust-lang#76455 - Changed some of the parsing code to return `InvalidDigit` rather than `Empty` for strings "+" and "-". https://users.rust-lang.org/t/misleading-error-in-str-parse-for-int-types/49178 - Carry the problem `char` with the `InvalidDigit` variant. - Necessary changes were made to the compiler as it depends on `int_error_matching`. - Redid tests to match on specific errors. r? `@KodrAus`
…t_2, r=KodrAus Refactor IntErrorKind to avoid "underflow" terminology This PR is a continuation of rust-lang#76455 # Changes - `Overflow` renamed to `PosOverflow` and `Underflow` renamed to `NegOverflow` after discussion in rust-lang#76455 - Changed some of the parsing code to return `InvalidDigit` rather than `Empty` for strings "+" and "-". https://users.rust-lang.org/t/misleading-error-in-str-parse-for-int-types/49178 - Carry the problem `char` with the `InvalidDigit` variant. - Necessary changes were made to the compiler as it depends on `int_error_matching`. - Redid tests to match on specific errors. r? ``@KodrAus``
…t_2, r=KodrAus Refactor IntErrorKind to avoid "underflow" terminology This PR is a continuation of rust-lang#76455 # Changes - `Overflow` renamed to `PosOverflow` and `Underflow` renamed to `NegOverflow` after discussion in rust-lang#76455 - Changed some of the parsing code to return `InvalidDigit` rather than `Empty` for strings "+" and "-". https://users.rust-lang.org/t/misleading-error-in-str-parse-for-int-types/49178 - Carry the problem `char` with the `InvalidDigit` variant. - Necessary changes were made to the compiler as it depends on `int_error_matching`. - Redid tests to match on specific errors. r? ```@KodrAus```
ParseIntError
andIntErrorKind
fully public #55705The original PR was my first
std
contribution. Since then a few people have called for it to be stabilized. See discussion on #22639A significant number of people seem to be using this feature in their projects https://github.com/search?p=2&q=%23%21%5Bfeature%28int_error_matching%29%5D&type=Code
Unanswered questions
Originally posted by @tspiteri in #22639 (comment)
Originally posted by @JarrettBillingsley in #22639 (comment)
I personally don't think it needs to change as in this position underflow is clearly associated with integers and seems consistent with other uses of the word underflow in
std
. I am interested to hear others thoughts.