Skip to content
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

Document panicking cases for integer division and remainder #82683

Merged
merged 2 commits into from
Mar 22, 2021

Commits on Mar 1, 2021

  1. Document panicking cases for integer division

    The panic on division by zero is expected, but the panic on overflow
    is somewhat surprising (since most arithmetic operations panic on
    overflow only when `debug_assertions` is enabled). As a result, it's
    helpful to document this behavior.
    jturner314 committed Mar 1, 2021
    Configuration menu
    Copy the full SHA
    9278b4c View commit details
    Browse the repository at this point in the history
  2. Document panicking cases for integer remainder

    The panic when the right operand is `0` is expected, but the
    overflow-related panic (which occurs only for `MIN % -1`) is somewhat
    surprising for two reasons: a return value of `0` would be reasonable
    in this case, and, for most arithmetic operations, overflow results in
    panic only when `debug_assertions` is enabled. As a result, it's
    helpful to document this behavior.
    jturner314 committed Mar 1, 2021
    Configuration menu
    Copy the full SHA
    b458550 View commit details
    Browse the repository at this point in the history