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 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7 help: surround the struct literal with parentheses
9 LL | if x == (E::I { field1: true, field2: 42 }) {}
12 error: struct literals are not allowed here
13 --> $DIR/struct-literal-variant-in-if.rs:15:13
15 LL | if x == E::V { field: false } {}
16 | ^^^^^^^^^^^^^^^^^^^^^
18 help: surround the struct literal with parentheses
20 LL | if x == (E::V { field: false }) {}
23 error: struct literals are not allowed here
24 --> $DIR/struct-literal-variant-in-if.rs:17:13
26 LL | if x == E::J { field: -42 } {}
29 help: surround the struct literal with parentheses
31 LL | if x == (E::J { field: -42 }) {}
34 error: struct literals are not allowed here
35 --> $DIR/struct-literal-variant-in-if.rs:19:13
37 LL | if x == E::K { field: "" } {}
40 help: surround the struct literal with parentheses
42 LL | if x == (E::K { field: "" }) {}
45 error[E0423]: expected value, found struct variant `E::V`
46 --> $DIR/struct-literal-variant-in-if.rs:10:13
48 LL | if x == E::V { field } {}
51 help: surround the struct literal with parentheses
53 LL | if x == (E::V { field }) {}
56 error[E0308]: mismatched types
57 --> $DIR/struct-literal-variant-in-if.rs:10:20
59 LL | if x == E::V { field } {}
60 | ---------------^^^^^--
62 | | expected `()`, found `bool`
63 | expected this to be `()`
65 error[E0308]: mismatched types
66 --> $DIR/struct-literal-variant-in-if.rs:21:20
68 LL | let y: usize = ();
69 | ----- ^^ expected `usize`, found `()`
71 | expected due to this
73 error: aborting due to 7 previous errors
75 Some errors have detailed explanations: E0308, E0423.
76 For more information about an error, try `rustc --explain E0308`.