-
Notifications
You must be signed in to change notification settings - Fork 902
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
extern is replaced with extern "C" for wasm extern functions #2908
Comments
This was briefly discussed at rustwasm/wasm-bindgen#422, and while wonky it was seen as "we don't have much choice!" |
The simd128 PR in stdsimd contains these changes and the build is green, so 👍 |
I ran into this again now that rustfmt is able to format most of the
However, @topecongiro I think this is just an instance of rustfmt trying to format code inside a macro, and ending up breaking the macro. A procedural macro is still a macro. |
@topecongiro - what are we thinking in terms of resolving this one? do we want to allow an implicit abi on foreign item mods even when I've yet to do anything with wasm, but my sense from these threads is that the insertion of the explicit abi is undesirable and a bit puzzling so I'm guessing users don't actually want or need to be able to have the explicit abi inserted. |
I've been thinking about it lately that when using the default configuration, rustfmt should not modify code that could lead to semantic changes. It is hard to do this correctly because of the proc macro, but we should try whenever possible. With that mind, regarding this issue, I'd like to change the default value of |
The style guide prescribes being explicit which I presume is why rustfmt defaults to true. Do we need to update the style guide as well?
|
Yes, that's right. Maybe tone it down a bit and change |
Even if we softened the language a bit, I still feel like we'd end up in a scenario where rustfmt's default wouldn't follow the prescribed style guide approach for ABIs. I also have some concerns that changing the default to not be explicit across the board to address the wasm use case may negatively impact the other cases where the conversion to explicit ABI is preferred (rust-lang/style-team#52) 🤔 I see a few options:
I'm going to try to set aside some time in the next few days to work on this (assuming on one beats me to it), and would be happy to open PRs for options 2 and 3 for consideration. However, let me know if you definitely want to just press on with option 2 @topecongiro |
@calebcartwright I agree that in most scenarios, it is desirable to normalize to explicit abi. As I said, I would like to be careful about adding/removing non-whitespace tokens. In this particular case, however, as you mentioned in option 1, users can work around this issue by adding an arbitrary abi by themselves; so just implementing the option 3 may be enough. Thank you for your insight.
Amazing ❤️ Note that the semantic change of the code is not limited to |
I am getting this diff with rustfmt in stdsimd, is this intended (@nrc , @topecongiro ) / correct (cc @alexcrichton) ?
The text was updated successfully, but these errors were encountered: