fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. 2 3Erroneous code examples: 4 5```compile_fail,E0308 6fn plus_one(x: i32) -> i32 { 7 x + 1 8} 9 10plus_one(\"Not a number\"); 11// ^^^^^^^^^^^^^^ expected `i32`, found `&str` 12 13if \"Not a bool\" { 14// ^^^^^^^^^^^^ expected `bool`, found `&str` 15} 16 17let x: f32 = \"Not a float\"; 18// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` 19// | 20// expected due to this 21``` 22 23This error occurs when an expression was used in a place where the compiler 24expected an expression of a different type. It can occur in several cases, the 25most common being when calling a function and passing an argument which has a 26different type than the matching type in the function declaration. 27"},"level":"error","spans":[{"file_name":"$DIR/flag-json.rs","byte_start":243,"byte_end":245,"line_start":7,"line_end":7,"column_start":17,"column_end":19,"is_primary":true,"text":[{"text":" let _: () = 42;","highlight_start":17,"highlight_end":19}],"label":"expected `()`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/flag-json.rs","byte_start":238,"byte_end":240,"line_start":7,"line_end":7,"column_start":12,"column_end":14,"is_primary":false,"text":[{"text":" let _: () = 42;","highlight_start":12,"highlight_end":14}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0308]: mismatched types 28 --> $DIR/flag-json.rs:7:17 29 | 30LL | ..._: () = 42; 31 | -- ^^ expected `()`, found integer 32 | | 33 | expected due to this 34 35"} 36{"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error 37 38"} 39{"message":"For more information about this error, try `rustc --explain E0308`.","code":null,"level":"failure-note","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0308`. 40"}