Skip to content

Async gets removed from extern blocks. #4288

@rodrigorc

Description

@rodrigorc

Describe the bug

The async keyword is removed when used inside an extern "C" block.

Currently this is not valid in Rust, because in C there are no async functions. But when using wasm-bindgen it is processes from a macro, and the functions are actually Javascript, not C, and there there are JS promises. Anyway, even if it is not valid, the keyword should not be removed while formatting.

To Reproduce

Format the following code:

extern "C" {
    async fn foo();
}

And see how the async keword disappears.

Expected behavior

It should keep the async keyword.

Meta

  • rustfmt version: 1.4.15-beta (530eadf 2020-06-02)
  • From where did you install rustfmt?: Rustup
  • How do you run rustfmt: From console: rustfmt --edition 2018 test.rs

Metadata

Metadata

Assignees

Labels

bugPanic, non-idempotency, invalid code, etc.good first issueIssues up for grabs, also good candidates for new rustfmt contributorshelp wanted

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions