@@ -55,6 +55,28 @@ help: parentheses are required to parse this as an expression
55
55
LL | ({ true }) | { true }
56
56
| + +
57
57
58
+ error: expected expression, found `+`
59
+ --> $DIR/expr-as-stmt.rs:69:26
60
+ |
61
+ LL | match () { () => 1 } + match () { () => 1 }
62
+ | ^ expected expression
63
+ |
64
+ help: parentheses are required to parse this as an expression
65
+ |
66
+ LL | (match () { () => 1 }) + match () { () => 1 }
67
+ | + +
68
+
69
+ error: expected expression, found `+`
70
+ --> $DIR/expr-as-stmt.rs:75:18
71
+ |
72
+ LL | unsafe { 1 } + unsafe { 1 }
73
+ | ^ expected expression
74
+ |
75
+ help: parentheses are required to parse this as an expression
76
+ |
77
+ LL | (unsafe { 1 }) + unsafe { 1 }
78
+ | + +
79
+
58
80
error[E0308]: mismatched types
59
81
--> $DIR/expr-as-stmt.rs:64:7
60
82
|
@@ -201,7 +223,26 @@ help: parentheses are required to parse this as an expression
201
223
LL | ({ true }) || { true }
202
224
| + +
203
225
204
- error: aborting due to 18 previous errors
226
+ error[E0308]: mismatched types
227
+ --> $DIR/expr-as-stmt.rs:69:5
228
+ |
229
+ LL | match () { () => 1 } + match () { () => 1 }
230
+ | ^^^^^^^^^^^^^^^^^^^^- help: consider using a semicolon here
231
+ | |
232
+ | expected `()`, found integer
233
+
234
+ error[E0308]: mismatched types
235
+ --> $DIR/expr-as-stmt.rs:75:14
236
+ |
237
+ LL | unsafe { 1 } + unsafe { 1 }
238
+ | ^ expected `()`, found integer
239
+ |
240
+ help: you might have meant to return this value
241
+ |
242
+ LL | unsafe { return 1; } + unsafe { 1 }
243
+ | ++++++ +
244
+
245
+ error: aborting due to 22 previous errors
205
246
206
247
Some errors have detailed explanations: E0308, E0600, E0614.
207
248
For more information about an error, try `rustc --explain E0308`.
0 commit comments