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: struct literals are not allowed here
12 --> $DIR/struct-literal-variant-in-if.rs:15:13
14 LL | if x == E::V { field: false } {}
15 | ^^^^^^^^^^^^^^^^^^^^^
16 help: surround the struct literal with parenthesis
18 LL | if x == (E::V { field: false }) {}
21 error: struct literals are not allowed here
22 --> $DIR/struct-literal-variant-in-if.rs:17:13
24 LL | if x == E::J { field: -42 } {}
26 help: surround the struct literal with parenthesis
28 LL | if x == (E::J { field: -42 }) {}
31 error: struct literals are not allowed here
32 --> $DIR/struct-literal-variant-in-if.rs:19:13
34 LL | if x == E::K { field: "" } {}
36 help: surround the struct literal with parenthesis
38 LL | if x == (E::K { field: "" }) {}
41 error[E0423]: expected value, found struct variant `E::V`
42 --> $DIR/struct-literal-variant-in-if.rs:10:13
44 LL | if x == E::V { field } {}
47 | help: surround the struct literal with parenthesis: `(E::V { field })`
49 error[E0308]: mismatched types
50 --> $DIR/struct-literal-variant-in-if.rs:10:20
52 LL | fn test_E(x: E) {
53 | - help: try adding a return type: `-> bool`
54 LL | let field = true;
55 LL | if x == E::V { field } {}
56 | ^^^^^ expected (), found bool
58 = note: expected type `()`
61 error[E0308]: mismatched types
62 --> $DIR/struct-literal-variant-in-if.rs:21:20
64 LL | let y: usize = ();
65 | ^^ expected usize, found ()
67 = note: expected type `usize`
70 error: aborting due to 7 previous errors
72 Some errors have detailed explanations: E0308, E0423.
73 For more information about an error, try `rustc --explain E0308`.