1 error: struct literals are not allowed here
2 --> $DIR/struct-literal-variant-in-if.rs:13:13
4 LL | if x == E::I { field1: true, field2: 42 } {}
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6 help: surround the struct literal with parenthesis
8 LL | if x == (E::I { field1: true, field2: 42 }) {}
11 error: expected identifier, found keyword `false`
12 --> $DIR/struct-literal-variant-in-if.rs:15:27
14 LL | if x == E::V { field: false } {}
15 | ^^^^^ expected identifier, found keyword
16 help: you can escape reserved keywords to use them as identifiers
18 LL | if x == E::V { field: r#false } {}
21 error: expected type, found keyword `false`
22 --> $DIR/struct-literal-variant-in-if.rs:15:27
24 LL | if x == E::V { field: false } {}
25 | ^^^^^ expecting a type here because of type ascription
27 = note: type ascription is a nightly-only feature that lets you annotate an expression with a type: `<expr>: <type>`
28 note: this expression expects an ascribed type after the colon
29 --> $DIR/struct-literal-variant-in-if.rs:15:20
31 LL | if x == E::V { field: false } {}
33 = help: this might be indicative of a syntax error elsewhere
35 error: struct literals are not allowed here
36 --> $DIR/struct-literal-variant-in-if.rs:19:13
38 LL | if x == E::J { field: -42 } {}
40 help: surround the struct literal with parenthesis
42 LL | if x == (E::J { field: -42 }) {}
45 error: struct literals are not allowed here
46 --> $DIR/struct-literal-variant-in-if.rs:21:13
48 LL | if x == E::K { field: "" } {}
50 help: surround the struct literal with parenthesis
52 LL | if x == (E::K { field: "" }) {}
55 error[E0423]: expected value, found struct variant `E::V`
56 --> $DIR/struct-literal-variant-in-if.rs:10:13
58 LL | if x == E::V { field } {}
61 | help: surround the struct literal with parenthesis: `(E::V { field })`
63 error[E0423]: expected value, found struct variant `E::V`
64 --> $DIR/struct-literal-variant-in-if.rs:15:13
66 LL | if x == E::V { field: false } {}
67 | ^^^^-----------------
69 | help: surround the struct literal with parenthesis: `(E::V { field: false })`
71 error[E0308]: mismatched types
72 --> $DIR/struct-literal-variant-in-if.rs:10:20
74 LL | fn test_E(x: E) {
75 | - help: try adding a return type: `-> bool`
76 LL | let field = true;
77 LL | if x == E::V { field } {}
78 | ^^^^^ expected (), found bool
80 = note: expected type `()`
83 error[E0308]: mismatched types
84 --> $DIR/struct-literal-variant-in-if.rs:23:20
86 LL | let y: usize = ();
87 | ^^ expected usize, found ()
89 = note: expected type `usize`
92 error: aborting due to 9 previous errors
94 Some errors occurred: E0308, E0423.
95 For more information about an error, try `rustc --explain E0308`.