> If the requested behaviour is unspecified (just `a+b`), overflows cause runtime panic.
As far as I know most machines can't trap on signed integer overflow. Which means having runtime panic is not practical. The page you linked says "no checking by default for optimized builds".
Ok, I simplified this too much. For full details of what happens you'll have to read the docs.
The non-release mode panics. Release mode with debug asserts turned on panics. Release mode with forced overflow checks panics. Release mode with no special options results in the same result as a wrapping operation.
Checked operations: https://doc.rust-lang.org/std/primitive.i8.html#method.check...
Saturating: https://doc.rust-lang.org/std/primitive.i8.html#method.satur...
Wrapping: https://doc.rust-lang.org/std/primitive.i8.html#method.wrapp...
Wrapping with notification: https://doc.rust-lang.org/std/primitive.i8.html#method.overf...
These apply to shifts too and you can tag types themselves to always behave one way. Overflows at compile time are caught as errors. More info at:
https://github.com/rust-lang/rust/issues/22020
If the requested behaviour is unspecified (just `a+b`), overflows cause runtime panic (edit: or wrapping behaviour in release build)
See https://doc.rust-lang.org/1.7.0/reference.html#behavior-not-...