Uh oh!
There was an error while loading. Please reload this page.
doc: improve None condition doc for checked_div and checked_rem - #46947
Conversation
rust-highfive
commented
Dec 22, 2017
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @aidanhs (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
aidanhs
commented
Dec 24, 2017
r? @steveklabnik maybe? |
frewsxcv
commented
Jan 6, 2018
makes sense to me! thanks for clarifying this @bors r+ rollup |
bors
commented
Jan 6, 2018
📌 Commit f2c5472 has been approved by |
…ewsxcv doc: improve None condition doc for `checked_div` and `checked_rem` This commit improves the condition mentioned in the docs for which `checked_div` and `checked_rem` return `None`. For signed division, the commit changes "the operation results in overflow" to "the division results in overflow", otherwise there is room for misinterpretation for `checked_rem`: Without considering overflow, `MIN % -1` would be simply zero, allowing the misinterpretation that "the operation" does not result in overflow in this case. This ambiguity is removed using "when the division results in overflow". For unsigned division, the condition for `None` should be simply when `rhs == 0`, as no other overflow is possible.
This commit improves the condition mentioned in the docs for which
checked_divandchecked_remreturnNone.For signed division, the commit changes "the operation results in overflow" to "the division results in overflow", otherwise there is room for misinterpretation for
checked_rem: Without considering overflow,MIN % -1would be simply zero, allowing the misinterpretation that "the operation" does not result in overflow in this case. This ambiguity is removed using "when the division results in overflow".For unsigned division, the condition for
Noneshould be simply whenrhs == 0, as no other overflow is possible.