Skip to content

Conversation

@daxpedda
Copy link
Contributor

@daxpedda daxpedda commented Dec 17, 2025

This PR adds a new target feature for Wasm targets: GC.

I went ahead and made this insta-stable because it has already passed phase 5 in addition to being implemented and stabilized by all major JS engines.

This doesn't enable the target feature by default!

For context: while this proposal adds a lot of new features to Wasm, they are not accessible through Rust apart from unstable inline ASM. This is largely useful to signal tools to make use of the feature, e.g. wasm-bindgen, where this can be used to make some pretty optimizations.

Companion PR: rust-lang/reference#2114.

r? @alexcrichton

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 17, 2025
@rust-log-analyzer

This comment has been minimized.

@daxpedda
Copy link
Contributor Author

Ah, 'tis unfortunate, will have to wait until the next LLVM version.

@daxpedda daxpedda marked this pull request as draft December 17, 2025 20:41
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 17, 2025
@alexcrichton
Copy link
Member

Looks good to me, thanks! You can update this function to skip the feature on unsupported LLVM versions. Do you have a use case in mind for the insta-stable-ness? I would expect that the GC configuration for wasm-bindgen would be out-of-band rather than via a compiler configuration (e.g. an extra flag to wasm-bindgen itself)

@daxpedda
Copy link
Contributor Author

daxpedda commented Dec 19, 2025

Do you have a use case in mind for the insta-stable-ness? I would expect that the GC configuration for wasm-bindgen would be out-of-band rather than via a compiler configuration (e.g. an extra flag to wasm-bindgen itself)

wasm-bindgen has shifted to removing extra CLI configurations in favor of automatic detection, e.g. reference types, multivalue and other proposals. So instead of a --enable-gc flag we want to detect target_feature = "gc".

In the meantime of course wasm-bindgen might just introduce a switch.

@rustbot rustbot added the A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. label Dec 19, 2025
@daxpedda
Copy link
Contributor Author

You can update this function to skip the feature on unsupported LLVM versions.

Done.

@alexcrichton
Copy link
Member

What would you think about landing this unstable and having a follow-up PR to switch it to stable? That'd help and get this in without merge conflicts and it can be separated from the FCP required for stabilization too. I'm not actually certain myself which team would need to sign off on this, T-lang or T-compiler, in terms of stabilization

@daxpedda
Copy link
Contributor Author

daxpedda commented Dec 19, 2025

What would you think about landing this unstable and having a follow-up PR to switch it to stable? That'd help and get this in without merge conflicts and it can be separated from the FCP required for stabilization too. I'm not actually certain myself which team would need to sign off on this, T-lang or T-compiler, in terms of stabilization

Yeah, why not!

I will open a follow-up PR right away for stabilization so we can get that rolling in the meantime until LLVM 22 is released (a long way off probably).

@daxpedda daxpedda marked this pull request as ready for review December 19, 2025 19:23
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants