error literal-overflow
Целочисленный литерал не помещается в выведенный тип.
What it means#
An integer literal that does not fit the type inferred from its context is a compile-time error (§1.5). A literal without a suffix gets its type from the context, or i64 if there is none.
Example#
fn main() {
let level: u8 = 300 // <- literal-overflow (u8 holds 0..=255)
}error
literal-overflow
How to fix#
fn main() {
let level: u16 = 300
}Use a wider type, a smaller value, or a suffix that selects the intended type (300u16). Converting at run time with as panics when the value is out of range (§3.1).