rust/tests/ui/numbers-arithmetic
AngelicosPhosphoros 7c263adb2a Add support for cfg(overflow_checks)
This PR adds support for detecting if overflow checks are enabled in similar fashion as debug_assertions are detected.
Possible use-case of this, for example, if we want to use checked integer casts in builds with overflow checks, e.g.

```rust
pub fn cast(val: usize)->u16 {
    if cfg!(overflow_checks) {
        val.try_into().unwrap()
    }
    else{
        vas as _
    }
}
```

Resolves #91130.
Tracking issue: #111466.
2023-05-11 18:06:31 +04:00
..
arith-unsigned.rs
div-mod.rs
divide-by-zero.rs
float2.rs
float_math.rs
float-int-invalid-const-cast.rs
float-literal-inference.rs
float-nan.rs
float-signature.rs
float.rs
floatlits.rs
i8-incr.rs
i32-sub.rs
i128.rs
int-abs-overflow.rs
int.rs
integer-literal-radix.rs
integer-literal-suffix-inference-2.rs
integer-literal-suffix-inference-3.rs
integer-literal-suffix-inference.rs
issue-8460-const.noopt.stderr
issue-8460-const.opt_with_overflow_checks.stderr
issue-8460-const.opt.stderr
issue-8460-const.rs
issue-8460.rs
issue-105626.rs
mod-zero.rs
next-power-of-two-overflow-debug.rs
next-power-of-two-overflow-ndebug.rs
not-suggest-float-literal.rs
not-suggest-float-literal.stderr
num-wrapping.rs
numeric-method-autoexport.rs
overflow-attribute-works-1.rs Add support for cfg(overflow_checks) 2023-05-11 18:06:31 +04:00
overflow-attribute-works-2.rs Add support for cfg(overflow_checks) 2023-05-11 18:06:31 +04:00
overflowing-add.rs
overflowing-lsh-1.rs
overflowing-lsh-1.stderr
overflowing-lsh-2.rs
overflowing-lsh-2.stderr
overflowing-lsh-3.rs
overflowing-lsh-3.stderr
overflowing-lsh-4.rs
overflowing-lsh-4.stderr
overflowing-mul.rs
overflowing-neg-nonzero.rs
overflowing-neg.rs
overflowing-pow-signed.rs
overflowing-pow-unsigned.rs
overflowing-rsh-1.rs
overflowing-rsh-1.stderr
overflowing-rsh-2.rs
overflowing-rsh-2.stderr
overflowing-rsh-3.rs
overflowing-rsh-3.stderr
overflowing-rsh-4.rs
overflowing-rsh-4.stderr
overflowing-rsh-5.rs
overflowing-rsh-5.stderr
overflowing-rsh-6.rs
overflowing-rsh-6.stderr
overflowing-sub.rs
promoted_overflow_opt.rs
promoted_overflow.rs
saturating-float-casts-impl.rs
saturating-float-casts-wasm.rs
saturating-float-casts.rs
shift-near-oflo.rs
shift-various-types.rs
shift.rs
signed-shift-const-eval.rs
suggest-float-literal.fixed
suggest-float-literal.rs
suggest-float-literal.stderr
u8-incr-decr.rs
u8-incr.rs
u32-decr.rs
u128-as-f32.rs
u128.rs
uint.rs
unary-minus-suffix-inference.rs