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

Make the wasm_c_abi future compat warning a hard error #133951

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bjorn3
Copy link
Member

@bjorn3 bjorn3 commented Dec 6, 2024

This is the next step in getting rid of the broken C abi for wasm32-unknown-unknown.

The lint was made deny-by-default in #129534 3 months ago. This still keeps the -Zwasm-c-abi flag set to legacy by default. It will be flipped in a future PR.

cc #122532

@bjorn3 bjorn3 added O-wasm Target: WASM (WebAssembly), http://webassembly.org/ A-ABI Area: Concerning the application binary interface (ABI) labels Dec 6, 2024
@lcnr
Copy link
Contributor

lcnr commented Dec 6, 2024

given #129534

r? @workingjubilee @alexcrichton

does this need a compiler FCP?

@rustbot rustbot assigned workingjubilee and unassigned lcnr Dec 6, 2024
@rust-log-analyzer

This comment has been minimized.

Copy link
Contributor

@daxpedda daxpedda left a comment

Choose a reason for hiding this comment

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

I should note that the changes in #129534 did not actually start showing an error to users, it was still a warning by default.
See #129534 (comment)

@bjorn3 bjorn3 force-pushed the wasm_c_abi_lint_hard_error branch from 0ed0661 to e1f75dd Compare December 6, 2024 09:16
@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Dec 6, 2024
@bjorn3 bjorn3 mentioned this pull request Dec 6, 2024
@workingjubilee
Copy link
Member

workingjubilee commented Dec 6, 2024

Technically we are breaking like ~85 versions of a foundation ecosystem crate, so yeah, an FCP might be warranted, but also technically we're just fixing a bug.

If we do this, we should make sure we only do one FCP between this and #133952 though since they're the same decision: "We're killing this dead, yeah?"

@bjorn3 bjorn3 force-pushed the wasm_c_abi_lint_hard_error branch from e1f75dd to 10a3850 Compare December 6, 2024 13:40
@workingjubilee
Copy link
Member

Nominating for T-compiler:

We already accepted the MCP to phase out this behavior, but this is the "hard break" edge. If an FCP is desired before proceeding, now is the time to decide. We are technically breaking a crate on future versions of Rust. However it is the crate and target's maintainer wish that we do so, and this is the solution to a 4 year old issue:

We have heard no strong objection and this has been discussed for 4 years at this point, so any box-ticking formality is exactly that: a formality.

@rustbot label: +I-compiler-nominated

Also cc @daxpedda

@rustbot rustbot added the I-compiler-nominated Nominated for discussion during a compiler team meeting. label Dec 6, 2024
@jieyouxu jieyouxu added the T-lang Relevant to the language team, which will review and decide on the PR/issue. label Dec 12, 2024
@apiraino
Copy link
Contributor

Discussed in T-compiler triage on Zulip.

Even if it's just a sign-off, we want to loop in T-lang, seems the usual procedure for them is to FCP such changes.

@rustbot label -I-compiler-nominated +I-lang-easy-decision

@rustbot rustbot added I-lang-easy-decision Issue: The decision needed by the team is conjectured to be easy; this does not imply nomination and removed I-compiler-nominated Nominated for discussion during a compiler team meeting. labels Dec 12, 2024
@workingjubilee
Copy link
Member

workingjubilee commented Dec 12, 2024

To summarize even more summarily for T-lang:

extern "C" fn on wasm32 targets has used a creative ABI that emerged because Rust and C toolchain development were more historically contemporary to each other, as opposed to the usual "first C, then 10~40 years later, Rust". Unfortunately, wasm-bindgen needed something for a stable-ish wasm ABI to talk to JavaScript. A flawed lowering was written. It was not immediately fixed because fixing it would break wasm-bindgen. For a while the wasm32-unknown-emscripten target was an acceptable workaround, and in a nascent ecosystem which might have further growing pains, the next move was not obvious.

Things have settled and it has become clear that Rust should align the ABI of extern "C" fn with that used by C toolchains for other wasm32 targets.

Thanks to @alexcrichton and @daxpedda we have implemented a relatively-smooth migration path for wasm-bindgen. There should be no meaningful concerns going forward, and this will make code that wasn't compatible with C code be compatible again, according to the conventional understanding of extern "C" fn.

This is the next step in getting rid of the broken C abi for
wasm32-unknown-unknown.
@bjorn3 bjorn3 force-pushed the wasm_c_abi_lint_hard_error branch from 10a3850 to fde2b1b Compare December 16, 2024 12:18
@compiler-errors compiler-errors added the I-lang-nominated Nominated for discussion during a lang team meeting. label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ABI Area: Concerning the application binary interface (ABI) I-lang-easy-decision Issue: The decision needed by the team is conjectured to be easy; this does not imply nomination I-lang-nominated Nominated for discussion during a lang team meeting. O-wasm Target: WASM (WebAssembly), http://webassembly.org/ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants