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 Move /src/test to /tests 2023-01-11 09:32:08 +00:00
div-mod.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
divide-by-zero.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
float-int-invalid-const-cast.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
float-literal-inference.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
float-nan.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
float-signature.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
float.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
float2.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
float_math.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
floatlits.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
i8-incr.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
i32-sub.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
i128.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
int-abs-overflow.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
int.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
integer-literal-radix.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
integer-literal-suffix-inference-2.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
integer-literal-suffix-inference-3.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
integer-literal-suffix-inference.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-8460-const.noopt.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-8460-const.opt.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-8460-const.opt_with_overflow_checks.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-8460-const.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-8460.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-105626.rs Add regression test for #105626 2023-02-23 08:39:23 +09:00
mod-zero.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
next-power-of-two-overflow-debug.rs Support true and false as boolean flag params 2023-01-18 20:46:36 +01:00
next-power-of-two-overflow-ndebug.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
not-suggest-float-literal.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
not-suggest-float-literal.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
num-wrapping.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
numeric-method-autoexport.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
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 Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overflowing-lsh-1.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overflowing-lsh-1.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overflowing-lsh-2.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overflowing-lsh-2.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overflowing-lsh-3.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overflowing-lsh-3.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overflowing-lsh-4.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overflowing-lsh-4.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overflowing-mul.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overflowing-neg-nonzero.rs Implement Neg for signed non-zero integers. 2023-04-20 14:27:29 +09:00
overflowing-neg.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overflowing-pow-signed.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overflowing-pow-unsigned.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overflowing-rsh-1.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overflowing-rsh-1.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overflowing-rsh-2.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overflowing-rsh-2.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overflowing-rsh-3.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overflowing-rsh-3.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overflowing-rsh-4.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overflowing-rsh-4.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overflowing-rsh-5.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overflowing-rsh-5.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overflowing-rsh-6.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overflowing-rsh-6.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overflowing-sub.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
promoted_overflow.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
promoted_overflow_opt.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
saturating-float-casts-impl.rs Add some reasons why tests are ignored. 2023-04-15 16:11:42 -07:00
saturating-float-casts-wasm.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
saturating-float-casts.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
shift-near-oflo.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
shift-various-types.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
shift.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
signed-shift-const-eval.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
suggest-float-literal.fixed Move /src/test to /tests 2023-01-11 09:32:08 +00:00
suggest-float-literal.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
suggest-float-literal.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
u8-incr-decr.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
u8-incr.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
u32-decr.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
u128-as-f32.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
u128.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
uint.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
unary-minus-suffix-inference.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00