Is it possible to enable overflow checks in `--release` build in Rust?

Viewed 78

In --debug mode Rust, integer overflow is detected and it results in panic!(). Then, is it possible to enable this check in --release build without any additional compile option nor methods such as checked_add()? Pseudo code:

#[force(overflow_check)]

fn main() {
    //...
}

If possible, totally ignoring --release options is ok. Pseudo code:

#[forbid(optimization)]

fn main() {
    //...
}

Why without any additional compile option? Because I'd like to enable overflow check in competitive programming environment in which I have no control over how my code is built.

0 Answers
Related