Skip to main content

E0008: General Type Mismatch

The type of an expression doesn't match the expected type.

Example

fn main() {
let x: bool = 42; // Error: expected type `bool`, found `i64`
}

How to fix

Ensure the expression has the correct type:

fn main() {
let x: bool = true; // OK
}

Or adjust the type annotation:

fn main() {
let x: i64 = 42; // OK
}