ARITHMETIC_OVERFLOW in rustc_lint::builtin - Rust
Description: The `arithmetic_overflow` lint detects that an arithmetic operation will overflow.

Skip to main content

## ARITHMETIC_OVERFLOW

# Static ARITHMETIC_OVERFLOW

Source

    pub static ARITHMETIC_OVERFLOW: &'static 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.