-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
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
TaKO8Ki
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.