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

`async fn` inside inherent impl produces generic parse error on 2015 edition #53714

Open
comex opened this Issue Aug 26, 2018 · 1 comment

Comments

Projects
None yet
3 participants
@comex
Copy link
Contributor

comex commented Aug 26, 2018

When compiling for the 2018 edition, rustc allows async fn both outside of an impl and within an inherent impl.

When compiling for the 2015 edition, async fn works outside of an impl, but putting one inside an inherent impl produces this error:

error: missing `fn`, `type`, or `const` for impl-item declaration
 --> src/lib.rs:4:9
  |
4 | impl A { async fn inside_impl() {} }
  |         ^ missing `fn`, `type`, or `const`

Either this should be allowed, or it should result in a better error message that recommends switching to the 2018 edition.

@withoutboats

This comment has been minimized.

Copy link
Contributor

withoutboats commented Aug 26, 2018

Since async blocks and some versions of the final await syntax cannot be permitted (for backward compatibility reasons), it seems preferable to disallow all async/await features on 2015 to simplifier the user story: async/await works on 2018.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment