E1091: literal does not fit the cast target
A cast of an integer literal is checked while compiling (ADR-0042).
A cast of an integer literal is checked while compiling (ADR-0042). If the
literal is outside the range of the target type, the cast could only trap, so
it is rejected. A negated literal counts as one signed constant, so -1 as u8
is rejected and -1 as i8 is accepted. The message names the literal and the
target type. The error points at the literal. A cast of a value that is only
known at run time is checked when it executes.
Example
actus
Fix
Use a target type that holds the value, or a value that fits.
actus
actus
Run actus explain E1091 in your terminal to read this entry offline. Browse Ownership & types or all error codes.