Proposal
This is a proposal to promote the wasm32-wasip3 target to Tier 2 without host tools. This target was initially added in #147205. The high-level goals of this target are:
- Keep up-to-date with the WASI standard. The WebAssembly WASI Subgroup has now officially released the WASI specification at 0.3.0 and is going to be a primary area of focus going forward. It's expected that toolchains will migrate to using these API definitions and the goal here is for Rust to continue its leadership role in the WASI toolchain space.
- The WASIp3 target focuses primarily on native support for async host functions. APIs are now specified with
async and have access to stream<T> and future<T> types in the component model. This notably greatly expands the possibilities of what guest programs can do by much more neatly integrating with async systems and enabling composition with other guest programs.
- A future release of WASIp3, 0.3.x, will have support for cooperative multithreading (spec-wise). This will enable code using
std::thread to work on wasm32-wasip3 by default. As of today WASIp3 will continue to not support std::thread (it returns an error), but this'll change in a compatible fashion in the future. This implementation will not have true parallelism but will instead leverage WASIp3's API definitions and async features to implement this in a cooperative stack-switching manner. This is expected to be a boon for portability as it'll be much easier to run threaded code in WebAssembly contexts, and this is expected to be greatly beneficial despite true parallelism not being available just yet.
Up until now Rust has not supported wasm32-wasip3 at a Tier 2 level due to the instability in the WASI specification itself. For example WASI has previously been versioned as 0.3.0-rc-YYYY-MM-DD and has gone through a number of mutually incompatible versions. This is the primary reason for the lack of Tier 2 status prior to this, and another reason for a lack of usage of this target. That being said development has still been underway for WASIp3 in a number of ways:
- WASIp3 is composable with WASIp2. All testing in Rust so far has used the
wasm32-wasip2 target which then additionally uses WASIp3 APIs in user code. The purpose of wasm32-wasip3, however, is to have the standard library also participate in using WASIp3 instead of WASIp2 (composes better with threads/async for example).
- Rust's bindings generation solution, wit-bindgen, has kept up-to-date with the specification and supports all WASIp3 features.
- The
wasip3 crate supports the current WASIp3 specification and has idiomatic bindings for all of WASIp3.
- The majority of testing and experimentation has been done with Rust up to now and the
wasm32-wasip3 target is expected to be the next stage in this process.
- The wasi-libc repository has been fully updated with native WASIp3 support, which is what Rust uses for most native I/O APIs (e.g. files, sockets, etc). Rust is planned to use wasi-libc for threads, as well.
- The wasi-sdk repository has additionally been fully updated with WASIp3 support, sporting sysroots for WASIp3.
Promotion to Tier 2 for this target is also a component (hah!) of the 2026 project goal WebAssembly Components.
This new wasm32-wasip3 target is not expected to affect the preexisting wasm32-wasip1 and wasm32-wasip2 targets. While it's still expected that one day these targets will all be sunset and deprecated in favor of a wasm32-wasi target (for WASI 1.0), in the near-to-medium term these targets will all continue to exist for the various embeddings that accept them. My personal expectation is that it might be possible to phase out the wasm32-wasip2 target sooner than the wasm32-wasip1 target once runtimes/embeddings update to support WASIp3, but that's still just conjecture on my part. My other expectation, however, is that the relative maintenance of these WASI targets in the standard library is minimal with changes such as #147572 where WASI is "just another unix".
I'll also note here that for testing this target it's still expected that external testing is the primary vector. The standard library itself still primarily only tests wasm32-wasip1 on CI. Once std::thread is supported I'd like to change this to testing wasm32-wasip3 instead because it will enable far more tests, but that's an MCP for another day.
LLVM, ABI, and WASIp3
LLVM 23, not yet currently released, has been updated to use a different ABI for some fundamental features in WebAssembly on the WASIp3 target. An example of this is that the stack pointer lives in a different location than it does today, and this is all in preparation for cooperative threads coming down the pike later on. In the meantime, however, this means that LLVM 22-and-prior cannot be mixed with LLVM 23-and-later. Rust ships precompiled object files from wasi-sdk for wasi-libc, and thus the LLVM used to produce wasi-libc/wasi-sdk must be compatible with Rust's LLVM in this regard.
The current plan is that a PR for the tier 2 target in Rust will not be made for wasm32-wasip3 until LLVM 23 is used. This means that both Rust and wasi-libc will be using LLVM 23. It's still possible to use LLVM 22, but embedders using their own LLVM version will need to take care to compile wasi-libc with the same version of LLVM they're using for Rust, too.
The formal requirements for a Tier 2 target are listed here below with my own personal commentary on them as well:
A tier 2 target must have value to people other than its maintainers. (It may still be a niche target, but it must not be exclusively useful for an inherently closed group.)
Akamai, F5, Fastly, and Microsoft are all interested companies in the development of WASI and wasm32-wasip3. This is not an exhaustive list,.
A tier 2 target must have a designated team of developers (the “target maintainers”) available to consult on target-specific build-breaking issues, or if necessary to develop target-specific language or library implementation details. This team must have at least 2 developers.
Maintainers will be @alexcrichton and @yoshuawuyts
The target must not place undue burden on Rust developers not specifically concerned with that target. Rust developers are expected to not gratuitously break a tier 2 target, but are not expected to become experts in every tier 2 target, and are not expected to provide target-specific implementations for every tier 2 target.
Maintenance of wasm32-wasip3 is not expected to be substantively different than wasm32-wasip1 or wasm32-wasip2. Both of those targets are already Tier 2, and efforts such as #147572 are attempting to actively reduce the maintenance burden. I'm not personally aware of any other known active burdens, but am always on-call to help out should they arise.
The target must provide documentation for the Rust community explaining how to build for the target using cross-compilation, and explaining how to run tests for the target. If at all possible, this documentation should show how to run Rust programs and tests for the target using emulation, to allow anyone to do so. If the target cannot be feasibly emulated, the documentation should explain how to obtain and work with physical hardware, cloud systems, or equivalent.
I'll update Rust documentation at https://doc.rust-lang.org/nightly/rustc/platform-support/wasm32-wasip3.html when this target is promoted (to mention rustup for example). This target will also make its way into Wasmtime documentation, Component Model documentation, Spin documentation, etc. Compiler development using this target more-or-less already works with minor hiccups which will be documented as well.
The target must document its baseline expectations for the features or versions of CPUs, operating systems, libraries, runtime environments, and similar.
All WebAssembly targets at this time, except wasm32v1-none, share the same documentation in this regard found in the documentation of the wasm32-unknown-unknown target. WASI itself will be versioned at 0.3.x specifically for this target with no guarantee as to what "x" is. This matches the wasm32-wasip2 target, for example, which is versioned at 0.2.x for WASIp2 without specifying "x". It's expected that new WASIp3 APIs will not be required by the Rust standard library until runtimes have had sufficient time to update, and it will be documented in the target documentation if/when this happens.
If introducing a new tier 2 or higher target that is identical to an existing Rust target except for the baseline expectations for the features or versions of CPUs, operating systems, libraries, runtime environments, and similar, then the proposed target must document to the satisfaction of the approving teams why the specific difference in baseline expectations provides sufficient value to justify a separate target.
I suppose I'm a primary maintainer of the wasm32-wasip2 target which is the most similar here, and, yes, I officially agree that it makes sense to add wasm32-wasip3.
Tier 2 targets must not leave any significant portions of core or the standard library unimplemented or stubbed out, unless they cannot possibly be supported on the target.
The wasm32-wasip3 target will be a superset of the preexisting Tier 2 wasm32-wasip2 target. In the coming months this will include an impementation of std::thread which will remove one of the primary porting difficulties trasitioning from native to WASI.
The code generation backend for the target should not have deficiencies that invalidate Rust safety properties, as evaluated by the Rust compiler team. (This requirement does not apply to arbitrary security enhancements or mitigations provided by code generation backends, only to those properties needed to ensure safe Rust code cannot cause undefined behavior or other unsoundness.) If this requirement does not hold, the target must clearly and prominently document any such limitations as part of the target’s entry in the target tier list, and ideally also via a failing test in the testsuite. The Rust compiler team must be satisfied with the balance between these limitations and the difficulty of implementing the necessary features.
There are no known deficiences in the WebAssembly backend of LLVM, or at least not that I'm aware of.
If the target supports C code, and the target has an interoperable calling convention for C code, the Rust target must support that C calling convention for the platform via extern "C". The C calling convention does not need to be the default Rust calling convention for the target, however.
This is what's implemented for wasm32-wasip2, and will be true for wasm32-wasip3 as well. The standard library itself heavily uses wasi-libc via FFI calls to implement itself.
The target must build reliably in CI, for all components that Rust’s CI considers mandatory.
Building wasm32-wasip3 will require nothing more than wasm32-wasip2, which is to say a wasi-sdk download and wasm-component-ld.
The approving teams may additionally require that a subset of tests pass in CI, such as enough to build a functional “hello world” program, ./x.py test --no-run, or equivalent “smoke tests”. In particular, this requirement may apply if the target builds host tools, or if the tests in question provide substantial value via early detection of critical problems.
LLVM's WebAssembly backend, and the standard library's WebAssembly-specific code, are all tested through the wasm32-wasip1 target in CI. It's not planned to add any testing of wasm32-wasip3 to CI at this time. Eventually when std::thread is fully supported I'd like to submit a follow-up MCP to change the WASI target tested in CI to expand test coverage, however.
Building the target in CI must not take substantially longer than the current slowest target in CI, and should not substantially raise the maintenance burden of the CI infrastructure. This requirement is subjective, to be evaluated by the infrastructure team, and will take the community importance of the target into account.
This target will take no more time than wasm32-wasip2 to build, which is already negligible.
Tier 2 targets should, if at all possible, support cross-compiling. Tier 2 targets should not require using the target as the host for builds, even if the target supports host tools.
Cross-compiling to wasm32-wasip3 is supported, and actively encouraged, for all host platforms.
In addition to the legal requirements for all targets (specified in the tier 3 requirements), because a tier 2 target typically involves the Rust project building and supplying various compiled binaries, incorporating the target and redistributing any resulting compiled binaries (e.g. built libraries, host tools if any) must not impose any onerous license requirements on any members of the Rust project, including infrastructure team members and those operating CI systems. This is a subjective requirement, to be evaluated by the approving teams.
Nothing new that wasn't already applicable for wasm32-wasip2 is going to come up for wasm32-wasip3.
Tier 2 targets must not impose burden on the authors of pull requests, or other developers in the community, to ensure that tests pass for the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on tests failing for the target. Do not send automated messages or notifications (via any medium, including via @) to a PR author or others involved with a PR regarding the PR breaking tests on a tier 2 target, unless they have opted into such messages.
Understood, there will be no such automation for the wasm32-wasip3 target.
The target maintainers should regularly run the testsuite for the target, and should fix any test failures in a reasonably timely fashion.
I'll do my best to do this, but I'll be honest in that I've not really done this for other WASI targets either. Thankfully this hasn't been a huge issue, however, and there haven't been regressions I'm aware of (fingers crossed!)
All requirements for tier 3 apply.
Everything here is still checked off, and I'm happy to go into detail if anyone has any questions about anything in particular.
Mentors or Reviewers
@WesleyWiser
Process
The main points of the Major Change Process are as follows:
You can read more about Major Change Proposals on forge.
Proposal
This is a proposal to promote the
wasm32-wasip3target to Tier 2 without host tools. This target was initially added in #147205. The high-level goals of this target are:asyncand have access tostream<T>andfuture<T>types in the component model. This notably greatly expands the possibilities of what guest programs can do by much more neatly integrating with async systems and enabling composition with other guest programs.std::threadto work onwasm32-wasip3by default. As of today WASIp3 will continue to not supportstd::thread(it returns an error), but this'll change in a compatible fashion in the future. This implementation will not have true parallelism but will instead leverage WASIp3's API definitions and async features to implement this in a cooperative stack-switching manner. This is expected to be a boon for portability as it'll be much easier to run threaded code in WebAssembly contexts, and this is expected to be greatly beneficial despite true parallelism not being available just yet.Up until now Rust has not supported
wasm32-wasip3at a Tier 2 level due to the instability in the WASI specification itself. For example WASI has previously been versioned as 0.3.0-rc-YYYY-MM-DD and has gone through a number of mutually incompatible versions. This is the primary reason for the lack of Tier 2 status prior to this, and another reason for a lack of usage of this target. That being said development has still been underway for WASIp3 in a number of ways:wasm32-wasip2target which then additionally uses WASIp3 APIs in user code. The purpose ofwasm32-wasip3, however, is to have the standard library also participate in using WASIp3 instead of WASIp2 (composes better with threads/async for example).wasip3crate supports the current WASIp3 specification and has idiomatic bindings for all of WASIp3.wasm32-wasip3target is expected to be the next stage in this process.Promotion to Tier 2 for this target is also a component (hah!) of the 2026 project goal WebAssembly Components.
This new
wasm32-wasip3target is not expected to affect the preexistingwasm32-wasip1andwasm32-wasip2targets. While it's still expected that one day these targets will all be sunset and deprecated in favor of awasm32-wasitarget (for WASI 1.0), in the near-to-medium term these targets will all continue to exist for the various embeddings that accept them. My personal expectation is that it might be possible to phase out thewasm32-wasip2target sooner than thewasm32-wasip1target once runtimes/embeddings update to support WASIp3, but that's still just conjecture on my part. My other expectation, however, is that the relative maintenance of these WASI targets in the standard library is minimal with changes such as #147572 where WASI is "just another unix".I'll also note here that for testing this target it's still expected that external testing is the primary vector. The standard library itself still primarily only tests
wasm32-wasip1on CI. Oncestd::threadis supported I'd like to change this to testingwasm32-wasip3instead because it will enable far more tests, but that's an MCP for another day.LLVM, ABI, and WASIp3
LLVM 23, not yet currently released, has been updated to use a different ABI for some fundamental features in WebAssembly on the WASIp3 target. An example of this is that the stack pointer lives in a different location than it does today, and this is all in preparation for cooperative threads coming down the pike later on. In the meantime, however, this means that LLVM 22-and-prior cannot be mixed with LLVM 23-and-later. Rust ships precompiled object files from wasi-sdk for wasi-libc, and thus the LLVM used to produce wasi-libc/wasi-sdk must be compatible with Rust's LLVM in this regard.
The current plan is that a PR for the tier 2 target in Rust will not be made for
wasm32-wasip3until LLVM 23 is used. This means that both Rust and wasi-libc will be using LLVM 23. It's still possible to use LLVM 22, but embedders using their own LLVM version will need to take care to compile wasi-libc with the same version of LLVM they're using for Rust, too.The formal requirements for a Tier 2 target are listed here below with my own personal commentary on them as well:
Akamai, F5, Fastly, and Microsoft are all interested companies in the development of WASI and
wasm32-wasip3. This is not an exhaustive list,.Maintainers will be @alexcrichton and @yoshuawuyts
Maintenance of
wasm32-wasip3is not expected to be substantively different thanwasm32-wasip1orwasm32-wasip2. Both of those targets are already Tier 2, and efforts such as #147572 are attempting to actively reduce the maintenance burden. I'm not personally aware of any other known active burdens, but am always on-call to help out should they arise.I'll update Rust documentation at https://doc.rust-lang.org/nightly/rustc/platform-support/wasm32-wasip3.html when this target is promoted (to mention
rustupfor example). This target will also make its way into Wasmtime documentation, Component Model documentation, Spin documentation, etc. Compiler development using this target more-or-less already works with minor hiccups which will be documented as well.All WebAssembly targets at this time, except
wasm32v1-none, share the same documentation in this regard found in the documentation of thewasm32-unknown-unknowntarget. WASI itself will be versioned at 0.3.x specifically for this target with no guarantee as to what "x" is. This matches thewasm32-wasip2target, for example, which is versioned at 0.2.x for WASIp2 without specifying "x". It's expected that new WASIp3 APIs will not be required by the Rust standard library until runtimes have had sufficient time to update, and it will be documented in the target documentation if/when this happens.I suppose I'm a primary maintainer of the
wasm32-wasip2target which is the most similar here, and, yes, I officially agree that it makes sense to addwasm32-wasip3.The
wasm32-wasip3target will be a superset of the preexisting Tier 2wasm32-wasip2target. In the coming months this will include an impementation ofstd::threadwhich will remove one of the primary porting difficulties trasitioning from native to WASI.There are no known deficiences in the WebAssembly backend of LLVM, or at least not that I'm aware of.
This is what's implemented for
wasm32-wasip2, and will be true forwasm32-wasip3as well. The standard library itself heavily uses wasi-libc via FFI calls to implement itself.Building
wasm32-wasip3will require nothing more thanwasm32-wasip2, which is to say a wasi-sdk download andwasm-component-ld.LLVM's WebAssembly backend, and the standard library's WebAssembly-specific code, are all tested through the
wasm32-wasip1target in CI. It's not planned to add any testing ofwasm32-wasip3to CI at this time. Eventually whenstd::threadis fully supported I'd like to submit a follow-up MCP to change the WASI target tested in CI to expand test coverage, however.This target will take no more time than
wasm32-wasip2to build, which is already negligible.Cross-compiling to
wasm32-wasip3is supported, and actively encouraged, for all host platforms.Nothing new that wasn't already applicable for
wasm32-wasip2is going to come up forwasm32-wasip3.Understood, there will be no such automation for the
wasm32-wasip3target.I'll do my best to do this, but I'll be honest in that I've not really done this for other WASI targets either. Thankfully this hasn't been a huge issue, however, and there haven't been regressions I'm aware of (fingers crossed!)
Everything here is still checked off, and I'm happy to go into detail if anyone has any questions about anything in particular.
Mentors or Reviewers
@WesleyWiser
Process
The main points of the Major Change Process are as follows:
@rustbot secondor kickoff a team FCP with@rfcbot fcp $RESOLUTION.You can read more about Major Change Proposals on forge.