Skip to main content

E0009: Return Type Mismatch

The type of the returned value doesn't match the function's declared return type.

Example

fn get_number() -> i64 {
true // Error: return type `bool` does not match function signature `i64`
}

How to fix

Return a value of the correct type:

fn get_number() -> i64 {
42 // OK
}

Or change the function's return type:

fn get_flag() -> bool {
true // OK
}