@@ -55,6 +55,28 @@ help: parentheses are required to parse this as an expression
5555LL | ({ true }) | { true }
5656 | + +
5757
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+
5880error[E0308]: mismatched types
5981 --> $DIR/expr-as-stmt.rs:64:7
6082 |
@@ -201,7 +223,26 @@ help: parentheses are required to parse this as an expression
201223LL | ({ true }) || { true }
202224 | + +
203225
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
205246
206247Some errors have detailed explanations: E0308, E0600, E0614.
207248For more information about an error, try `rustc --explain E0308`.
0 commit comments