-
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
Tracking Issue for arithmetic that panics on overflow (strict_*
operations)
#118260
Comments
I have implemented something similar to this in the fixed crate, for example I used the prefix |
You mean |
Feature gate:
#![feature(strict_overflow_ops)]
This is a tracking issue for doing arithmetic that is guaranteed to panic on overflow, see the ACP for more details: rust-lang/libs-team#270.
Public API
For both signed and unsigned integers:
Additionally, signed integers have:
And unsigned integers have:
Steps / History
Unresolved Questions
strict_neg
on unsigned types? It's basically identical toassert_ne!(x, 0)
.strict_div
,strict_rem
,strict_div_euclid
andstrict_rem_euclid
on unsigned types? Those will never panic; they are identical to the non-strict versions.Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩
The text was updated successfully, but these errors were encountered: