

Note: The exception for literal expressions behind unary - means that forms such as -128_i8 or let j: i8 = -(128) never cause a panic and have the expected value of -128. Using > where the right-hand argument is greater than or equal to the number of bits in the type of the left-hand argument, or is negative.

These checks occur even when -C overflow-checks is disabled, for legacy reasons.

The following things are considered to be overflow: The -C debug-assertions and -C overflow-checks compiler flags can be used to control this more directly. Integer operators will panic when they overflow when compiled in debug mode. Many of the following operators can also be overloaded using traits in std::ops or std::cmp. Operators are defined for built in types by the Rust language. Macro Follow-Set Ambiguity Formal Specification
