@@ -77,6 +77,15 @@ help: parentheses are required to parse this as an expression
77
77
LL | (unsafe { 1 }) + unsafe { 1 }
78
78
| + +
79
79
80
+ error: expected `;`, found keyword `match`
81
+ --> $DIR/expr-as-stmt.rs:82:53
82
+ |
83
+ LL | match () { _ => true } && match () { _ => true }
84
+ | ^ help: add `;` here
85
+ LL |
86
+ LL | match () { _ => true } && true;
87
+ | ----- unexpected token
88
+
80
89
error[E0308]: mismatched types
81
90
--> $DIR/expr-as-stmt.rs:64:7
82
91
|
@@ -229,11 +238,7 @@ error[E0308]: mismatched types
229
238
LL | match () { () => 1 } + match () { () => 1 }
230
239
| ^^^^^^^^^^^^^^^^^^^^ expected `()`, found integer
231
240
|
232
- help: consider using a semicolon here
233
- |
234
- LL | match () { () => 1 }; + match () { () => 1 }
235
- | +
236
- help: alternatively, parentheses are required to parse this as an expression
241
+ help: parentheses are required to parse this as an expression
237
242
|
238
243
LL | (match () { () => 1 }) + match () { () => 1 }
239
244
| + +
@@ -249,7 +254,65 @@ help: you might have meant to return this value
249
254
LL | unsafe { return 1; } + unsafe { 1 }
250
255
| ++++++ +
251
256
252
- error: aborting due to 22 previous errors
257
+ error[E0308]: mismatched types
258
+ --> $DIR/expr-as-stmt.rs:81:5
259
+ |
260
+ LL | match () { _ => true } && match () { _ => true };
261
+ | ^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `bool`
262
+ |
263
+ help: parentheses are required to parse this as an expression
264
+ |
265
+ LL | (match () { _ => true }) && match () { _ => true };
266
+ | + +
267
+
268
+ error[E0308]: mismatched types
269
+ --> $DIR/expr-as-stmt.rs:82:5
270
+ |
271
+ LL | match () { _ => true } && match () { _ => true }
272
+ | ^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `bool`
273
+ |
274
+ help: parentheses are required to parse this as an expression
275
+ |
276
+ LL | (match () { _ => true }) && match () { _ => true }
277
+ | + +
278
+
279
+ error[E0308]: mismatched types
280
+ --> $DIR/expr-as-stmt.rs:84:5
281
+ |
282
+ LL | match () { _ => true } && true;
283
+ | ^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `bool`
284
+ |
285
+ help: parentheses are required to parse this as an expression
286
+ |
287
+ LL | (match () { _ => true }) && true;
288
+ | + +
289
+
290
+ error[E0308]: mismatched types
291
+ --> $DIR/expr-as-stmt.rs:85:5
292
+ |
293
+ LL | match () { _ => true } && true
294
+ | ^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `bool`
295
+ |
296
+ help: parentheses are required to parse this as an expression
297
+ |
298
+ LL | (match () { _ => true }) && true
299
+ | + +
300
+
301
+ error[E0308]: mismatched types
302
+ --> $DIR/expr-as-stmt.rs:85:28
303
+ |
304
+ LL | fn matches() -> bool {
305
+ | ---- expected `bool` because of return type
306
+ ...
307
+ LL | match () { _ => true } && true
308
+ | ^^^^^^^ expected `bool`, found `&&bool`
309
+ |
310
+ help: parentheses are required to parse this as an expression
311
+ |
312
+ LL | (match () { _ => true }) && true
313
+ | + +
314
+
315
+ error: aborting due to 28 previous errors
253
316
254
317
Some errors have detailed explanations: E0308, E0600, E0614.
255
318
For more information about an error, try `rustc --explain E0308`.
0 commit comments