@@ -8,32 +8,18 @@ help: surround the struct literal with parenthesis
8
8
LL | if x == (E::I { field1: true, field2: 42 }) {}
9
9
| ^ ^
10
10
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
23
13
|
24
14
LL | 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
30
17
|
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
+ | ^ ^
34
20
35
21
error: 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
37
23
|
38
24
LL | if x == E::J { field: -42 } {}
39
25
| ^^^^^^^^^^^^^^^^^^^
@@ -43,7 +29,7 @@ LL | if x == (E::J { field: -42 }) {}
43
29
| ^ ^
44
30
45
31
error: 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
47
33
|
48
34
LL | if x == E::K { field: "" } {}
49
35
| ^^^^^^^^^^^^^^^^^^
@@ -60,14 +46,6 @@ LL | if x == E::V { field } {}
60
46
| |
61
47
| help: surround the struct literal with parenthesis: `(E::V { field })`
62
48
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
-
71
49
error[E0308]: mismatched types
72
50
--> $DIR/struct-literal-variant-in-if.rs:10:20
73
51
|
@@ -81,15 +59,15 @@ LL | if x == E::V { field } {}
81
59
found type `bool`
82
60
83
61
error[E0308]: mismatched types
84
- --> $DIR/struct-literal-variant-in-if.rs:23 :20
62
+ --> $DIR/struct-literal-variant-in-if.rs:21 :20
85
63
|
86
64
LL | let y: usize = ();
87
65
| ^^ expected usize, found ()
88
66
|
89
67
= note: expected type `usize`
90
68
found type `()`
91
69
92
- error: aborting due to 9 previous errors
70
+ error: aborting due to 7 previous errors
93
71
94
- Some errors occurred : E0308, E0423.
72
+ Some errors have detailed explanations : E0308, E0423.
95
73
For more information about an error, try `rustc --explain E0308`.
0 commit comments