@@ -44,6 +44,25 @@ LL | _ => 1,
4444LL ~ }) > 0
4545 |
4646
47+ error: expected parameter name, found `{`
48+ --> $DIR/expr-as-stmt.rs:41:16
49+ |
50+ LL | { true } | { true }
51+ | ^ expected parameter name
52+ |
53+ help: parentheses are required to parse this as an expression
54+ |
55+ LL | ({ true }) | { true }
56+ | + +
57+
58+ error[E0308]: mismatched types
59+ --> $DIR/expr-as-stmt.rs:64:7
60+ |
61+ LL | { foo() } || { true }
62+ | ^^^^^- help: consider using a semicolon here: `;`
63+ | |
64+ | expected `()`, found `i32`
65+
4766error[E0308]: mismatched types
4867 --> $DIR/expr-as-stmt.rs:8:6
4968 |
@@ -121,7 +140,68 @@ help: parentheses are required to parse this as an expression
121140LL | ({2}) - 2
122141 | + +
123142
124- error: aborting due to 11 previous errors
143+ error[E0308]: mismatched types
144+ --> $DIR/expr-as-stmt.rs:41:7
145+ |
146+ LL | { true } | { true }
147+ | ^^^^ expected `()`, found `bool`
148+ |
149+ help: you might have meant to return this value
150+ |
151+ LL | { return true; } | { true }
152+ | ++++++ +
153+
154+ error[E0308]: mismatched types
155+ --> $DIR/expr-as-stmt.rs:46:7
156+ |
157+ LL | { true } && { true }
158+ | ^^^^ expected `()`, found `bool`
159+ |
160+ help: you might have meant to return this value
161+ |
162+ LL | { return true; } && { true }
163+ | ++++++ +
164+
165+ error[E0308]: mismatched types
166+ --> $DIR/expr-as-stmt.rs:46:14
167+ |
168+ LL | fn revenge_from_mars() -> bool {
169+ | ---- expected `bool` because of return type
170+ LL | { true } && { true }
171+ | ^^^^^^^^^^^ expected `bool`, found `&&bool`
172+ |
173+ help: parentheses are required to parse this as an expression
174+ |
175+ LL | ({ true }) && { true }
176+ | + +
177+
178+ error[E0308]: mismatched types
179+ --> $DIR/expr-as-stmt.rs:51:7
180+ |
181+ LL | { true } || { true }
182+ | ^^^^ expected `()`, found `bool`
183+ |
184+ help: you might have meant to return this value
185+ |
186+ LL | { return true; } || { true }
187+ | ++++++ +
188+
189+ error[E0308]: mismatched types
190+ --> $DIR/expr-as-stmt.rs:51:14
191+ |
192+ LL | fn attack_from_mars() -> bool {
193+ | ---- expected `bool` because of return type
194+ LL | { true } || { true }
195+ | ^^^^^^^^^^^ expected `bool`, found closure
196+ |
197+ = note: expected type `bool`
198+ found closure `[closure@$DIR/expr-as-stmt.rs:51:14: 51:25]`
199+ help: parentheses are required to parse this as an expression
200+ |
201+ LL | ({ true }) || { true }
202+ | + +
203+
204+ error: aborting due to 18 previous errors
125205
126206Some errors have detailed explanations: E0308, E0600, E0614.
127207For more information about an error, try `rustc --explain E0308`.
0 commit comments