Skip to content

Conversation

@alexcrichton
Copy link
Member

Over time with WASIp2 and WASIp3 the wit-bindgen crate has become unsuitable for inclusion in libstd. The goal of this commit is to fix all of these issues in favor of an eventual update of Rust's wasm32-wasip2 target to use the wasi crate directly. The high-level changes here are:

  • Support for a different wit-bindgen-runtime-crate and wit-bindgen-macro-crate is removed. This means old compat hacks are removed and additionally wit-bindgen-rt is merged back into wit-bindgen.
  • Support for disabling bitflags-the-dep is added by adding a dummy bitflags! definition which is used when the crate dependency is disabled. The bare-bones version gives just enough for bindings generation and basic usability.

This is tested with libstd and it at least gets to the point of building libstd itself when the wasi crate is regenerated with these changes.

This has long since become unnecessary, so delete it.
This was originally done a long time ago at this point to split out the
"abi stable bits" from `wit-bindgen` for the purpose of `cargo
component` where one version of the macro was used in the binary itself
and a different version might be linked at runtime. Over time though
this has proven effectively intractable and isn't really serving much
purpose any more. This commit instead merges everything into the
`wit-bindgen` crate. This should make it easier to integrate elsewhere
and additionally integrate into Rust's standard library.
Generate a bare-bones `bitflags!` macro.
Copy link
Contributor

@pchickey pchickey left a comment

Choose a reason for hiding this comment

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

Excited to see the separate -rt crate go away!

@sunfishcode
Copy link
Member

Noting this here as I just looked it up: bitflags used to support being built as a dependency of std, but it appears they recently removed that code. I think the minimal version here is fine for now, though in the future if this lands in upstream Rust, we may want to ask bitflags to re-introduce that code.

@alexcrichton alexcrichton added this pull request to the merge queue Aug 26, 2025
@alexcrichton
Copy link
Member Author

Oh good find! I can't really blame them though as it's weird esoteric code for one user, and for this it'd be for just one user of one platform. Given that this only affects the Rust standard library's use of the wasi crate itself I don't think it's too worthwhile to have more than the basics for bitflags! -- basically I'd be ok never asking bitflags to re-add the code. That being said I certainly wouldn't stop anyone as it's a weird thing here for sure to carry.

Merged via the queue into bytecodealliance:main with commit f61634f Aug 26, 2025
20 checks passed
@alexcrichton alexcrichton deleted the work-towards-std branch August 26, 2025 22:27
billf added a commit to billf/wit-bindgen that referenced this pull request Sep 6, 2025
presumably after bytecodealliance#1369, the following build feature combo fails to build:

```bash
cargo build -p wit-bindgen --no-default-features --features async
```
github-merge-queue bot pushed a commit that referenced this pull request Sep 7, 2025
presumably after #1369, the following build feature combo fails to build:

```bash
cargo build -p wit-bindgen --no-default-features --features async
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants