-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Closed
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-async-closures`async || {}``async || {}`A-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`AsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.Async-await issues that have been triaged during a working group meeting.C-bugCategory: This is a bug.Category: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.T-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.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.
Description
The following snippet:
#![feature(async_await)]
fn main() {
async || ({
})();
}produces the following error:
error[E0618]: expected function, found `()`
--> src/main.rs:4:14
|
4 | async || ({
| ______________^
| |______________|
| ||
5 | || })();
| ||______^_- call expression requires function
| |_______|
|
help: if you meant to create this closure and immediately call it, surround the closure with parenthesis
|
4 | async || (({
5 | }))();
|
However, applying this suggestion doesn't actually fix the error. Instead, it simply causes a new suggestion to be produced - this time with three parentheses (e.g. ((() instead of two.
Metadata
Metadata
Assignees
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-async-closures`async || {}``async || {}`A-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`AsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.Async-await issues that have been triaged during a working group meeting.C-bugCategory: This is a bug.Category: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.T-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.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.