@@ -8,32 +8,18 @@ help: surround the struct literal with parenthesis
88LL | if x == (E::I { field1: true, field2: 42 }) {}
99 | ^ ^
1010
11- error: expected identifier, found keyword `false`
12- --> $DIR/struct-literal-variant-in-if.rs:15:27
13- |
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
17- |
18- LL | if x == E::V { field: r#false } {}
19- | ^^^^^^^
20-
21- error: expected type, found keyword `false`
22- --> $DIR/struct-literal-variant-in-if.rs:15:27
11+ error: struct literals are not allowed here
12+ --> $DIR/struct-literal-variant-in-if.rs:15:13
2313 |
2414LL | if x == E::V { field: false } {}
25- | ^^^^^ expecting a type here because of type ascription
26- |
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
15+ | ^^^^^^^^^^^^^^^^^^^^^
16+ help: surround the struct literal with parenthesis
3017 |
31- LL | if x == E::V { field: false } {}
32- | ^^^^^
33- = help: this might be indicative of a syntax error elsewhere
18+ LL | if x == (E::V { field: false }) {}
19+ | ^ ^
3420
3521error: struct literals are not allowed here
36- --> $DIR/struct-literal-variant-in-if.rs:19 :13
22+ --> $DIR/struct-literal-variant-in-if.rs:17 :13
3723 |
3824LL | if x == E::J { field: -42 } {}
3925 | ^^^^^^^^^^^^^^^^^^^
@@ -43,7 +29,7 @@ LL | if x == (E::J { field: -42 }) {}
4329 | ^ ^
4430
4531error: struct literals are not allowed here
46- --> $DIR/struct-literal-variant-in-if.rs:21 :13
32+ --> $DIR/struct-literal-variant-in-if.rs:19 :13
4733 |
4834LL | if x == E::K { field: "" } {}
4935 | ^^^^^^^^^^^^^^^^^^
@@ -60,14 +46,6 @@ LL | if x == E::V { field } {}
6046 | |
6147 | help: surround the struct literal with parenthesis: `(E::V { field })`
6248
63- error[E0423]: expected value, found struct variant `E::V`
64- --> $DIR/struct-literal-variant-in-if.rs:15:13
65- |
66- LL | if x == E::V { field: false } {}
67- | ^^^^-----------------
68- | |
69- | help: surround the struct literal with parenthesis: `(E::V { field: false })`
70-
7149error[E0308]: mismatched types
7250 --> $DIR/struct-literal-variant-in-if.rs:10:20
7351 |
@@ -81,15 +59,15 @@ LL | if x == E::V { field } {}
8159 found type `bool`
8260
8361error[E0308]: mismatched types
84- --> $DIR/struct-literal-variant-in-if.rs:23 :20
62+ --> $DIR/struct-literal-variant-in-if.rs:21 :20
8563 |
8664LL | let y: usize = ();
8765 | ^^ expected usize, found ()
8866 |
8967 = note: expected type `usize`
9068 found type `()`
9169
92- error: aborting due to 9 previous errors
70+ error: aborting due to 7 previous errors
9371
94- Some errors occurred : E0308, E0423.
72+ Some errors have detailed explanations : E0308, E0423.
9573For more information about an error, try `rustc --explain E0308`.
0 commit comments