rustc_lint_defs::builtin

Static ARITHMETIC_OVERFLOW

Source
pub static ARITHMETIC_OVERFLOW: &Lint
Expand description

The arithmetic_overflow lint detects that an arithmetic operation will overflow.

§Example

1_i32 << 32;

{{produces}}

§Explanation

It is very likely a mistake to perform an arithmetic operation that overflows its value. If the compiler is able to detect these kinds of overflows at compile-time, it will trigger this lint. Consider adjusting the expression to avoid overflow, or use a data type that will not overflow.