1 Expected type did not match the received type.
3 Erroneous code examples:
6 fn plus_one(x: i32) -> i32 {
10 plus_one("Not a number");
11 // ^^^^^^^^^^^^^^ expected `i32`, found `&str`
14 // ^^^^^^^^^^^^ expected `bool`, found `&str`
17 let x: f32 = "Not a float";
18 // --- ^^^^^^^^^^^^^ expected `f32`, found `&str`
20 // expected due to this
23 This error occurs when an expression was used in a place where the compiler
24 expected an expression of a different type. It can occur in several cases, the
25 most common being when calling a function and passing an argument which has a
26 different type than the matching type in the function declaration.