3 ms·
Rust's semantics are: * in debug builds, you get a panic on overflow * otherwise, you may choose to panic, but if you do not, it is two's compliment wrapping
by steveklabnik 6y ago
Rust's semantics are:
* in debug builds, you get a panic on overflow
* otherwise, you may choose to panic, but if you do not, it is two's compliment wrapping
It is defined this way so that someday if checks get cheap enough we can enable them in release builds too, but at least it's not UB!