Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid suggestion when attempting to call async closure #62386

Open
Aaron1011 opened this issue Jul 4, 2019 · 1 comment

Comments

Projects
None yet
3 participants
@Aaron1011
Copy link
Contributor

commented Jul 4, 2019

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.

@Centril

This comment has been minimized.

Copy link
Member

commented Jul 5, 2019

Labeling as deferred since async closures are not getting stabilized in the MVP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.