Closed
Description
Given the following code:
async || {}()
The current output is:
error[[E0618]](https://doc.rust-lang.org/nightly/error-index.html#E0618): expected function, found `()`
--> src/main.rs:3:25
|
3 | let _fut = async || {}();
| ^^--
| |
| call expression requires function
|
help: if you meant to create this closure and immediately call it, surround the closure with parentheses
|
3 | let _fut = async || ({})();
| + +
Ideally the output should look like:
error[[E0618]](https://doc.rust-lang.org/nightly/error-index.html#E0618): expected function, found `()`
--> src/main.rs:3:25
|
3 | let _fut = async || {}();
| ^^--
| |
| call expression requires function
|
help: if you meant to create this closure and immediately call it, surround the closure with parentheses
|
3 | let _fut = (async || {})();
| + +
@rustbot modify labels +F-async_closure +requires-nightly