about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src/errors.rs
diff options
context:
space:
mode:
authorNadrieril <Nadrieril@users.noreply.github.com>2024-01-21 06:38:34 +0100
committerGitHub <noreply@github.com>2024-01-21 06:38:34 +0100
commitb661cd6c57766ea17da0e93daed75c1b37c34757 (patch)
treeb4fc43b6b136f61c00b59704fc1de5cee5e7f593 /compiler/rustc_pattern_analysis/src/errors.rs
parent867d39cdf625e4db4b381faff993346582e598b4 (diff)
parent6d17169104575315c7801ec7bc55dd3cb932fde8 (diff)
downloadrust-b661cd6c57766ea17da0e93daed75c1b37c34757.tar.gz
rust-b661cd6c57766ea17da0e93daed75c1b37c34757.zip
Rollup merge of #116090 - rmehri01:strict_integer_ops, r=m-ou-se
Implement strict integer operations that panic on overflow

This PR implements the first part of the ACP for adding panic on overflow style arithmetic operations (https://github.com/rust-lang/libs-team/issues/270), mentioned in #116064.

It adds the following operations on both signed and unsigned integers:

- `strict_add`
- `strict_sub`
- `strict_mul`
- `strict_div`
- `strict_div_euclid`
- `strict_rem`
- `strict_rem_euclid`
- `strict_neg`
- `strict_shl`
- `strict_shr`
- `strict_pow`

Additionally, signed integers have:

- `strict_add_unsigned`
- `strict_sub_unsigned`
- `strict_abs`

And unsigned integers have:

- `strict_add_signed`

The `div` and `rem` operations are the same as normal division and remainder but are added for completeness similar to the corresponding `wrapping_*` operations.

I'm not sure if I missed any operations, I basically found them from the `wrapping_*` and `checked_*` operations on both integer types.
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/errors.rs')
0 files changed, 0 insertions, 0 deletions