4 ms·
> AFAIU, Rust panics by default on signed overflow Overflow of any integer type is considered a "program error", not undefined behavior. In debug builds, this
by steveklabnik 9y ago
> AFAIU, Rust panics by default on signed overflow
Overflow of any integer type is considered a "program error", not undefined behavior. In debug builds, this is required to panic. In builds where it doesn't panic, it's well-defined as two's compliment wrapping.
You can also request explicit wrapping, saturating, etc behavior.