Skip to content

Comments

Develop bindings for WASI versions in parallel#118

Merged
alexcrichton merged 8 commits intobytecodealliance:mainfrom
alexcrichton:reorganize
Sep 9, 2025
Merged

Develop bindings for WASI versions in parallel#118
alexcrichton merged 8 commits intobytecodealliance:mainfrom
alexcrichton:reorganize

Conversation

@alexcrichton
Copy link
Member

@alexcrichton alexcrichton commented Sep 8, 2025

This commit is a reorganization of this crate to develop the WASIp{1,2,3} crate bindings in parallel with each other in separate crates. Historically the WASIp1 support ceased with the publication of 0.12.0 of the wasi crate which was the first release generated by wit-bindgen suitable for use with WASIp2. The rough idea was to do the same with WASIp3 at some point, but today it was realized that this probably won't work.

Specifically the version number of the wasi crate right now is tied to not only the WASI API version that's being bound but addition to the wit-bindgen that is generating bindings. If either one updates in a breaking way then the crate number here needs to be bumped. This means that if we want to develop both WASIp2 and WASIp3 at the same time we'd have to somehow reserve a space of future version numbers for the WASIp2 track which would be a bit awkward. Additionally it's a bit awkward to have non-main development of WASIp2, a supported target, when WASIp3 wants to be added.

This new crate organization is intended to solve this concerns and looks like so:

  • Each version of WASI now has its own crate. For example there's now a wasip1 crate and a wasip2 crate. Eventually there will be a wasip3 crate.
  • A version-specific WASI crate is developed on main of this repository and gets CI run, auto-generated bindings verified, etc. Versions will be published as necessary for each version of each crate.
  • The wasi crate is now a small wrapper around the latest stable WASI release available. Currently this is a stable reexport of the wasip2 crate.

Various bits of README documentation have all been updated to reflect this new structure. The intention is that in the near-ish future a wasip3 crate will be added which will contain auto-generated bindings for WASIp3 and its upcoming snapshots. This new wasip3 crate would not be integrated into the wasi crate and the wasi crate would continue to reexport wasip2. In this manner we can develop wasip3 more easily alongside the wasip2 crate.

Closes #117 (figured I'd throw this in)

This commit is a reorganization of this crate to develop the
WASIp{1,2,3} crate bindings in parallel with each other in separate
crates. Historically the WASIp1 support ceased with the publication of
0.12.0 of the `wasi` crate which was the first release generated by
`wit-bindgen` suitable for use with WASIp2. The rough idea was to do the
same with WASIp3 at some point, but today it was realized that this
probably won't work.

Specifically the version number of the `wasi` crate right now is tied to
not only the WASI API version that's being bound but addition to the
`wit-bindgen` that is generating bindings. If either one updates in a
breaking way then the crate number here needs to be bumped. This means
that if we want to develop both WASIp2 and WASIp3 at the same time we'd
have to somehow reserve a space of future version numbers for the WASIp2
track which would be a bit awkward. Additionally it's a bit awkward to
have non-`main` development of WASIp2, a supported target, when WASIp3
wants to be added.

This new crate organization is intended to solve this concerns and looks
like so:

* Each version of WASI now has its own crate. For example there's now a
  `wasip1` crate and a `wasip2` crate. Eventually there will be a
  `wasip3` crate.
* A version-specific WASI crate is developed on `main` of this
  repository and gets CI run, auto-generated bindings verified, etc.
  Versions will be published as necessary for each version of each crate.
* The `wasi` crate is now a small wrapper around the latest stable WASI
  release available. Currently this is a stable reexport of the `wasip2`
  crate.

Various bits of README documentation have all been updated to reflect
this new structure. The intention is that in the near-ish future a
`wasip3` crate will be added which will contain auto-generated bindings
for WASIp3 and its upcoming snapshots. This new `wasip3` crate would not
be integrated into the `wasi` crate and the `wasi` crate would continue
to reexport `wasip2`. In this manner we can develop `wasip3` more easily
alongside the `wasip2` crate.
@alexcrichton
Copy link
Member Author

Ok should be good to go now. I plan on next adapting #111 to this structure to get WASIp3 bindings bootstrapped.

@alexcrichton
Copy link
Member Author

Oh, I should also clarify, I've started wasip1/wasip2 crates at the 1.0.0 version track. They'd bump up naturally from there with any changes necessary. I plan on keeping wasi itself at 0.14 it's currently at (aka pre-1.0) until WASI has an official 1.0.

Copy link
Collaborator

@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.

I think we should set something in the authors field, "Bytecode Alliance Contributors" I guess? Otherwise lgtm

[package]
name = "wasi"
version = "0.14.4+wasi-0.2.4"
authors = ["The Cranelift Project Developers"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

"Bytecode Alliance"? "Alex Crichton"?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh nowadays Cargo/crates.io basically ignore this field and it's not even generated by default, and AFAIK the recommendation is to remove it so I went ahead and cleaned it up here

@alexcrichton alexcrichton merged commit 4ae7014 into bytecodealliance:main Sep 9, 2025
16 checks passed
@alexcrichton alexcrichton deleted the reorganize branch September 9, 2025 17:57
@bjorn3
Copy link

bjorn3 commented Dec 5, 2025

Would be nice to use the new wasip1 crate in libstd. That would allow getting rid of the wasi exception for a dependency lint at https://github.com/rust-lang/rust/blob/66428d92bec337ed4785d695d0127276a482278c/src/tools/tidy/src/deps.rs#L863-L866

@alexcrichton
Copy link
Member Author

Agreed! I was planning on getting around to that after rust-lang/rust#147572

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.

Set MSRV in Cargo.toml

3 participants