-
Notifications
You must be signed in to change notification settings - Fork 909
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 gets removed from extern blocks. #4288
Comments
The root cause is that the fields from the However, we could certainly tweak this to support maintaining the original qualifier, and it'd be up to users to remove their invalid usage of it (outside the wasm context) vs. rustfmt removing it for them. The relevant code for anyone interested in working on this can be found here: rustfmt/src/formatting/items.rs Lines 3136 to 3144 in 144c9ec
rustfmt/src/formatting/items.rs Lines 237 to 252 in 144c9ec
IMO the values set via |
Closes rust-lang#4288 And we get to drop a method, which I think is a win :)
Shoot, sorry @topecongiro, I had started working on this before you assigned yourself and failed to see your assignment. Feel free to close my PR if you'd like. Apologies for the duplication of work. |
Closes rust-lang#4288 And we get to drop a method, which I think is a win :)
Closes rust-lang#4288 And we get to drop a method, which I think is a win :)
Closes #4288 And we get to drop a method, which I think is a win :)
Describe the bug
The
async
keyword is removed when used inside anextern "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:
And see how the
async
keword disappears.Expected behavior
It should keep the
async
keyword.Meta
rustfmt --edition 2018 test.rs
The text was updated successfully, but these errors were encountered: