Skip to content

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

Closed
@comex

Description

@comex

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-async-awaitArea: Async & AwaitA-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions