unfit in i8 - run time - overflow



examples/numbers/overflow/src/main.rs
fn main() {
    let mut num: i8 = 126;
    println!("{num}");

    num += 1;
    println!("{num}");

    num += 1;
    println!("{num}");
}

cargo run


126
127
thread 'main' panicked at 'attempt to add with overflow', examples/intro/overflow.rs:6:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


cargo run --release


126
127
-128