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

don't convert implict ABI when doing so could fail to preserve semantics #4293

Merged

Conversation

calebcartwright
Copy link
Member

Fixes #2908 (option 3 from #2908 (comment))

Happy to open a separate/alternative PR with option 2 if we'd rather go that route 👍

Comment on lines +76 to +82
// Users that have an existing explicit ABI would need to convert to implicit
// manually, as rustfmt will be conservative and not attempt to convert explicit
// to implicit in the wasm case.
#[wasm_bindgen]
extern "C" {
fn foo() -> Bar;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I believe that an explicit C ABI became common practice with wasm_bindgen at least in part because of rustfmt 1.x behavior. However, I don't think we should attempt to help those users convert back to an implicit ABI as it seems to risky/error prone IMO; with this change, rustfmt 2.0 by default would permit users to do what they want and will no longer force Explicit ABIs.

Copy link
Contributor

@topecongiro topecongiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you!

@topecongiro topecongiro merged commit 8fb4fa5 into rust-lang:master Jun 30, 2020
@calebcartwright calebcartwright deleted the expl-abi-semantics-preservation branch July 27, 2020 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

extern is replaced with extern "C" for wasm extern functions
3 participants