]> git.lizzy.rs Git - rust.git/blob - src/test/ui/terminal-width/flag-json.stderr
Update description for error E0308
[rust.git] / src / test / ui / terminal-width / flag-json.stderr
1 {"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type.
2
3 Erroneous code examples:
4
5 ```compile_fail,E0308
6 fn plus_one(x: i32) -> i32 {
7     x + 1
8 }
9
10 plus_one(\"Not a number\");
11 //       ^^^^^^^^^^^^^^ expected `i32`, found `&str`
12
13 if \"Not a bool\" {
14 // ^^^^^^^^^^^^ expected `bool`, found `&str`
15 }
16
17 let x: f32 = \"Not a float\";
18 //     ---   ^^^^^^^^^^^^^ expected `f32`, found `&str`
19 //     |
20 //     expected due to this
21 ```
22
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.
27 "},"level":"error","spans":[{"file_name":"$DIR/flag-json.rs","byte_start":244,"byte_end":246,"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":239,"byte_end":241,"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    |
30 LL | ..._: () = 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 "}