Integer Overflow
Integer overflow during arithmetic operations MUST cause a runtime panic.
On overflow, the program MUST terminate with exit code 101 and print an error message.
The following operations MAY overflow:
- Addition (
+) - Subtraction (
-) - Multiplication (
*) - Negation (
-unary)
fn main() -> i32 {
2147483647 + 1 // Runtime error: integer overflow
}
fn main() -> i32 {
-2147483648 - 1 // Runtime error: integer overflow
}
Future versions of Rue may provide wrapping arithmetic operations that do not panic on overflow.