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

Should `extern "C" { ... }` be disallowed? #422

Closed
alexcrichton opened this issue Jul 8, 2018 · 2 comments
Labels

Comments

@alexcrichton
Copy link
Collaborator

@alexcrichton alexcrichton commented Jul 8, 2018

I've noticed in a few locations that we're annotating APIs with:

#[wasm_bindgen]
extern "C" {
     // ...
}

but under the hood there's not actually any semblance of "C"! In fact, it's somewhat more accurate to say something like:

#[wasm_bindgen]
extern "wasm-bindgen" {
    // ...
}

but that's a bit wordy and we shouldn't require that. Should we specifically deny extern "C"?

@ohanar

This comment has been minimized.

Copy link
Member

@ohanar ohanar commented Jul 8, 2018

The main thing that I don't really like about this is that the default rustfmt configuration wants an explicit abi (and presumably the style guide will have the same suggestion). You can stop rustfmt from auto-inserting "C"s by adding a custom configuration, but we would be asking that for any project that is using custom bindings and rustfmt.

@alexcrichton

This comment has been minimized.

Copy link
Collaborator Author

@alexcrichton alexcrichton commented Jul 9, 2018

Hm I guess that answers the question for us, alas!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.