#wasip2
🚨 EUVD-2026-108306
📊 5.9/10
🏢 bytecodealliance

📝 Wasmtime before 36.0.17, 37.0.0 before 48.0.4, and 49.0.0 before 49.0.2 contains an unbounded memory allocation in the wasmtime-wasi WASIp2 wri...

🔗 https://euvd.enisa.europa.eu/vulnerability/EUVD-2026-108306

#cybersecurity #infosec #cve #euvd
October 22, 2026 at 8:04 PM
the dream is still hella far off. gitoxide running in the browser atop a opfs impl of wasip2 or wasip3 would be the dream.
github.com/GitoxideLabs...
preliminary wasm32 support for git-pack by Byron · Pull Request #735 · GitoxideLabs/gitoxide
The goal of this PR is to make accelerated pack resolution available in WASM. This includes the following steps an iterator of entries that were decoded from a pack (the pack decoding is excluded ...
github.com
January 7, 2025 at 9:15 AM
tokio support for wasip2 would be so excellent. alas, the underlying mio got a NACK from the maintainer as is, so definitely not holding breath.
github.com/tokio-rs/tok...
github.com/tokio-rs/mio...
add wasm32-wasip2 support by dicej · Pull Request #6893 · tokio-rs/tokio
Motivation This adds support for the new wasm32-wasip2 target platform, which includes more extensive support for sockets than wasm32-wasip1 (formerly known as wasm32-wasi). Solution The bulk of ...
github.com
January 7, 2025 at 8:53 AM
I'd thought much of the justification for wit/component-model was as a pre-req for host-object bindings, enabling some DOM access from wasm. But everything has been so radio quiet since shipping wasip2.

Would love links on where shared identity stuff has tried to happen!? Definitely missed that!
November 13, 2024 at 6:41 PM
I have no cause to accuse you of shirking; you seem obviously very busy.

I do think wasm is kind of in limbo while component-model wasip2 moves from early to flourishing (both with runtime & lang support), and lack of wasi shims for browser prevents folks from getting started bringing to web.
October 30, 2024 at 4:01 AM
Major congrats to tinygo shipping wasip2
wasmcloud.com/blog/compile...
July 3, 2024 at 7:38 PM
wasip2ってもうtier2に入ったんだ
doc.rust-lang.org/nightly/rust...
wasm32-wasip2 - The rustc book
doc.rust-lang.org
December 27, 2024 at 6:49 PM
Rust 1.93.1 has been released.

This point release fixes three regressions that slipped into in Rust 1.93.0: an internal compiler error affecting rustfmt, a false positive in a clippy lint, and an issue with the wasm32-wasip2 target.

See the blog post for details: blog.rust-lang.org/2026/02/12/R...
Announcing Rust 1.93.1 | Rust Blog
Empowering everyone to build reliable and efficient software.
blog.rust-lang.org
February 12, 2026 at 9:15 PM
頑張って書いたけど長い。ファイル読んで標準出力するだけなのに長い!
#wasi #wasm

blog.iwate.me/wasip2%E3%81...
December 2, 2025 at 4:30 PM
No AI blogpost today 🤓

#WASI Preview 2 in one sentence: the contract becomes a file, and the tooling generates all the conversion code from it.

My first wasip2 component, in #Go with @tinygo.org, called from Node.js through jco.

k33g.org/p/20260816-w...

#WebAssembly #TinyGo
Building a WASIP 2 component with TinyGo
Build a WASI Preview 2 component in Go with TinyGo: the WIT contract, the generated bindings, the wasip2 build, and calling it from Node.js through jco.
k33g.org
August 16, 2026 at 9:01 AM
Spent a week on a wild goose chase following an LLM hallucination shared between Gemini *and* Claude; a reimplementation of wapc-go against the as-of-yet-unimplemented wasip2/Component Model.

We have really got to cure our agents of not-invented-here syndrome!
April 21, 2026 at 2:34 PM
Trouble with Rust ecosystem and roolchain in Termux
If you're using Rust built by Termux, then you only get what Termux provides, and you won't get ability to use `rustup`. It seems that you only get aarch64-linux-android armv7a-linux-androideabi i686-linux-android x86_64-linux-android wasm32-unknown-unknown wasm32-wasi wasm32-wasip1wasm32-wasip2 targets built-in, and nothing else. github.com #### termux/termux-packages/blob/master/packages/rust/build.sh TERMUX_PKG_HOMEPAGE=https://www.rust-lang.org/ TERMUX_PKG_DESCRIPTION="Systems programming language focused on safety, speed and concurrency" TERMUX_PKG_LICENSE="MIT" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="1.83.0" TERMUX_PKG_REVISION=2 TERMUX_PKG_SRCURL=https://static.rust-lang.org/dist/rustc-${TERMUX_PKG_VERSION}-src.tar.xz TERMUX_PKG_SHA256=7b11d4242dab0921a7d54758ad3fe805153c979c144625fecde11735760f97df _LLVM_MAJOR_VERSION=$(. $TERMUX_SCRIPTDIR/packages/libllvm/build.sh; echo $LLVM_MAJOR_VERSION) _LLVM_MAJOR_VERSION_NEXT=$((_LLVM_MAJOR_VERSION + 1)) _LZMA_VERSION=$(. $TERMUX_SCRIPTDIR/packages/liblzma/build.sh; echo $TERMUX_PKG_VERSION) TERMUX_PKG_DEPENDS="clang, libc++, libllvm (<< ${_LLVM_MAJOR_VERSION_NEXT}), lld, openssl, zlib" TERMUX_PKG_BUILD_DEPENDS="wasi-libc" TERMUX_PKG_NO_STATICSPLIT=true TERMUX_PKG_AUTO_UPDATE=true TERMUX_PKG_RM_AFTER_INSTALL=" bin/llc bin/llvm-* bin/opt bin/sh This file has been truncated. show original
users.rust-lang.org
December 8, 2024 at 3:35 PM
Rust's WASI Targets: What's Changing?

Rust 1.78 will introduce new `wasm32-wasip1` (tier 2) and `wasms32- wasip2' (tier 3) targets. Users of WASI 0.1 are encouraged to begin migrating to the new** 'wasm 32-wasi' target. The existing `wask32-unknown-unknown' and 'wassam32-emscript…
#hackernews #news
Rust's WASI Targets: What's Changing?
Rust 1.78 will introduce new `wasm32-wasip1` (tier 2) and `wasms32- wasip2' (tier 3) targets. Users of WASI 0.1 are encouraged to begin migrating to the new** 'wasm 32-wasi' target. The existing `wask32-unknown-unknown' and 'wassam32-emscripten' targets are unaffected by this post.
hackernoon.com
January 11, 2026 at 10:58 PM
Rust's WASI Targets Are Changing: Here's Why

Rust 1.78 will introduce new `wasm32-wasip1` (tier 2) and `wasms32- wasip2' (tier 3) targets. Users of WASI 0.1 are encouraged to begin migrating to the new** 'wasm 32-wasi' target. The existing `wASI-unknown-unknown' and 'wASi-unknown…
#hackernews #news
Rust's WASI Targets Are Changing: Here's Why
Rust 1.78 will introduce new `wasm32-wasip1` (tier 2) and `wasms32- wasip2' (tier 3) targets. Users of WASI 0.1 are encouraged to begin migrating to the new** 'wasm 32-wasi' target. The existing `wASI-unknown-unknown' and 'wASi-unknownemscripten' targets are unaffected by any changes.
hackernoon.com
December 13, 2025 at 12:50 AM
We haven't experimented much with Wasip2 yet, but your comment gives me the idea that we could recompile the wasmtime implementation with the Rust target...hmmm :)
March 20, 2025 at 12:24 AM
CVE-2026-58494 - Wasmtime: WASI hard links bypass wasmtime-wasi's FilePerms for destination
CVE ID : CVE-2026-58494

Published : July 8, 2026, 8:22 p.m. | 37 minutes ago

Description : Wasmtime is a runtime for WebAssembly. Prior to 24.0.11, 36.0.12, 45.0.3, and 46.0.1, wa...
CVE-2026-58494 - Wasmtime: WASI hard links bypass wasmtime-wasi's FilePerms for destination
Wasmtime is a runtime for WebAssembly. Prior to 24.0.11, 36.0.12, 45.0.3, and 46.0.1, wasmtime-wasi hard-link creation and renaming check directory permissions but not matching FilePerms on source and destination preopens, allowing a WASI guest with a read-only source file capability to overwrite host files exposed as FilePerms::READ through wasip1, wasip2, …
cvefeed.io
July 8, 2026 at 10:25 PM
The wasm32-wasip2 Target Has Reached Tier 2 Support
## Introduction In April of this year we posted an update about Rust's WASI targets to the main Rust blog. In it we covered the rename of the `wasm32-wasi` target to `wasm32-wasip1`, and the introduction of the new `wasm32-wasip2` target as a "tier 3" target. This meant that while the target was available as part of `rust-lang/rustc`, it was not guaranteed to build. We're pleased to announce that this has changed in Rust 1.82. For those unfamiliar with WebAssembly (Wasm) components and WASI 0.2, here is a quick, simplified primer: * **Wasm** is a (virtual) instruction format for programs to be compiled into (think: x86). * **Wasm Components** are a container format and type system that wrap Core Wasm instructions into typed, hermetic binaries and libraries (think: ELF). * **WASI** is a reserved namespace for a collection of standardized Wasm component interfaces (think: POSIX header files). For a more detailed explanation see the WASI 0.2 announcement post on the Bytecode Alliance blog. ## What's new? Starting Rust 1.82 (2024-10-17) the `wasm32-wasip2` (WASI 0.2) target has reached tier-2 platform support in the Rust compiler. Among other things this now means it is guaranteed to build, and is now available to install via Rustup using the following command: rustup target add wasm32-wasip2 Up until now Rust users writing Wasm Components would always have to rely on tools (such as cargo-component) which target the WASI 0.1 target (`wasm32-wasip1`) and package it into a WASI 0.2 Component via a post-processing step invoked. Now that `wasm32-wasip2` is available to everyone via Rustup, tooling can begin to directly target WASI 0.2 without the need for additional post-processing. What this also means is that ecosystem crates can begin targeting WASI 0.2 directly for platform-specific code. WASI 0.1 did not have support for sockets. Now that we have a stable tier 2 platform available, crate authors should be able to finally start writing WASI-compatible network code. To target WASI 0.2 from Rust, authors can use the following `cfg` attribute: #[cfg(all(target_os = "wasi", target_env = "p2"))] mod wasip2 { // items go here } To target the older WASI 0.1 target, Rust also accepts `target_env = "p1"`. ## Standard Library Support The WASI 0.2 Rust target reaching tier 2 platform support is in a way just the beginning. means it's supported and stable. While the platform itself is now stable, support in the stdlib for WASI 0.2 APIs is still limited. While the WASI 0.2 specification specifies APIs for example for timers, files, and sockets - if you try and use the stdlib APIs for these today, you'll find they don't yet work. We expect to gradually extend the Rust stdlib with support for WASI 0.2 APIs throughout the remainder of this year into the next. That work has already started, with rust-lang/rust#129638 adding native support for `std::net` in Rust 1.83. We expect more of these PRs to land through the remainder of the year. Though this doesn't need to stop users from using WASI 0.2 today. The stdlib is great because it provides _portable_ abstractions, usually built on top of an operating system's `libc` or equivalent. If you want to use WASI 0.2 APIs directly today, you can either use the wasi crate directly. Or generate your own WASI bindings from the WASI specification's interface types using wit-bindgen. ## Conclusion The `wasm32-wasip2` target is now installable via Rustup. This makes it possible for the Rust compiler to directly compile to the Wasm Components format targeting the WASI 0.2 interfaces. There is now also a way for crates to compile add WASI 0.2 platform support by writing: #[cfg(all(target_os = "wasi", target_env = "p2"))] mod wasip2 {} We're excited for Wasm Components and WASI 0.2 to have reached this milestone within the Rust project, and are excited to see what folks in the community will be building with it!
blog.rust-lang.org
January 25, 2025 at 4:04 PM
The wasm32-wasip2 Target Has Reached Tier 2 Support
## Introduction In April of this year we posted an update about Rust's WASI targets to the main Rust blog. In it we covered the rename of the `wasm32-wasi` target to `wasm32-wasip1`, and the introduction of the new `wasm32-wasip2` target as a "tier 3" target. This meant that while the target was available as part of `rust-lang/rustc`, it was not guaranteed to build. We're pleased to announce that this has changed in Rust 1.82. For those unfamiliar with WebAssembly (Wasm) components and WASI 0.2, here is a quick, simplified primer: * **Wasm** is a (virtual) instruction format for programs to be compiled into (think: x86). * **Wasm Components** are a container format and type system that wrap Core Wasm instructions into typed, hermetic binaries and libraries (think: ELF). * **WASI** is a reserved namespace for a collection of standardized Wasm component interfaces (think: POSIX header files). For a more detailed explanation see the WASI 0.2 announcement post on the Bytecode Alliance blog. ## What's new? Starting Rust 1.82 (2024-10-17) the `wasm32-wasip2` (WASI 0.2) target has reached tier-2 platform support in the Rust compiler. Among other things this now means it is guaranteed to build, and is now available to install via Rustup using the following command: rustup target add wasm32-wasip2 Up until now Rust users writing Wasm Components would always have to rely on tools (such as cargo-component) which target the WASI 0.1 target (`wasm32-wasip1`) and package it into a WASI 0.2 Component via a post-processing step invoked. Now that `wasm32-wasip2` is available to everyone via Rustup, tooling can begin to directly target WASI 0.2 without the need for additional post-processing. What this also means is that ecosystem crates can begin targeting WASI 0.2 directly for platform-specific code. WASI 0.1 did not have support for sockets. Now that we have a stable tier 2 platform available, crate authors should be able to finally start writing WASI-compatible network code. To target WASI 0.2 from Rust, authors can use the following `cfg` attribute: #[cfg(all(target_os = "wasi", target_env = "p2"))] mod wasip2 { // items go here } To target the older WASI 0.1 target, Rust also accepts `target_env = "p1"`. ## Standard Library Support The WASI 0.2 Rust target reaching tier 2 platform support is in a way just the beginning. means it's supported and stable. While the platform itself is now stable, support in the stdlib for WASI 0.2 APIs is still limited. While the WASI 0.2 specification specifies APIs for example for timers, files, and sockets - if you try and use the stdlib APIs for these today, you'll find they don't yet work. We expect to gradually extend the Rust stdlib with support for WASI 0.2 APIs throughout the remainder of this year into the next. That work has already started, with rust-lang/rust#129638 adding native support for `std::net` in Rust 1.83. We expect more of these PRs to land through the remainder of the year. Though this doesn't need to stop users from using WASI 0.2 today. The stdlib is great because it provides _portable_ abstractions, usually built on top of an operating system's `libc` or equivalent. If you want to use WASI 0.2 APIs directly today, you can either use the wasi crate directly. Or generate your own WASI bindings from the WASI specification's interface types using wit-bindgen. ## Conclusion The `wasm32-wasip2` target is now installable via Rustup. This makes it possible for the Rust compiler to directly compile to the Wasm Components format targeting the WASI 0.2 interfaces. There is now also a way for crates to compile add WASI 0.2 platform support by writing: #[cfg(all(target_os = "wasi", target_env = "p2"))] mod wasip2 {} We're excited for Wasm Components and WASI 0.2 to have reached this milestone within the Rust project, and are excited to see what folks in the community will be building with it!
blog.rust-lang.org
January 7, 2025 at 4:04 PM
The wasm32-wasip2 Target Has Reached Tier 2 Support
## Introduction In April of this year we posted an update about Rust's WASI targets to the main Rust blog. In it we covered the rename of the `wasm32-wasi` target to `wasm32-wasip1`, and the introduction of the new `wasm32-wasip2` target as a "tier 3" target. This meant that while the target was available as part of `rust-lang/rustc`, it was not guaranteed to build. We're pleased to announce that this has changed in Rust 1.82. For those unfamiliar with WebAssembly (Wasm) components and WASI 0.2, here is a quick, simplified primer: * **Wasm** is a (virtual) instruction format for programs to be compiled into (think: x86). * **Wasm Components** are a container format and type system that wrap Core Wasm instructions into typed, hermetic binaries and libraries (think: ELF). * **WASI** is a reserved namespace for a collection of standardized Wasm component interfaces (think: POSIX header files). For a more detailed explanation see the WASI 0.2 announcement post on the Bytecode Alliance blog. ## What's new? Starting Rust 1.82 (2024-10-17) the `wasm32-wasip2` (WASI 0.2) target has reached tier-2 platform support in the Rust compiler. Among other things this now means it is guaranteed to build, and is now available to install via Rustup using the following command: rustup target add wasm32-wasip2 Up until now Rust users writing Wasm Components would always have to rely on tools (such as cargo-component) which target the WASI 0.1 target (`wasm32-wasip1`) and package it into a WASI 0.2 Component via a post-processing step invoked. Now that `wasm32-wasip2` is available to everyone via Rustup, tooling can begin to directly target WASI 0.2 without the need for additional post-processing. What this also means is that ecosystem crates can begin targeting WASI 0.2 directly for platform-specific code. WASI 0.1 did not have support for sockets. Now that we have a stable tier 2 platform available, crate authors should be able to finally start writing WASI-compatible network code. To target WASI 0.2 from Rust, authors can use the following `cfg` attribute: #[cfg(all(target_os = "wasi", target_env = "p2"))] mod wasip2 { // items go here } To target the older WASI 0.1 target, Rust also accepts `target_env = "p1"`. ## Standard Library Support The WASI 0.2 Rust target reaching tier 2 platform support is in a way just the beginning. means it's supported and stable. While the platform itself is now stable, support in the stdlib for WASI 0.2 APIs is still limited. While the WASI 0.2 specification specifies APIs for example for timers, files, and sockets - if you try and use the stdlib APIs for these today, you'll find they don't yet work. We expect to gradually extend the Rust stdlib with support for WASI 0.2 APIs throughout the remainder of this year into the next. That work has already started, with rust-lang/rust#129638 adding native support for `std::net` in Rust 1.83. We expect more of these PRs to land through the remainder of the year. Though this doesn't need to stop users from using WASI 0.2 today. The stdlib is great because it provides _portable_ abstractions, usually built on top of an operating system's `libc` or equivalent. If you want to use WASI 0.2 APIs directly today, you can either use the wasi crate directly. Or generate your own WASI bindings from the WASI specification's interface types using wit-bindgen. ## Conclusion The `wasm32-wasip2` target is now installable via Rustup. This makes it possible for the Rust compiler to directly compile to the Wasm Components format targeting the WASI 0.2 interfaces. There is now also a way for crates to compile add WASI 0.2 platform support by writing: #[cfg(all(target_os = "wasi", target_env = "p2"))] mod wasip2 {} We're excited for Wasm Components and WASI 0.2 to have reached this milestone within the Rust project, and are excited to see what folks in the community will be building with it!
blog.rust-lang.org
December 26, 2024 at 4:04 PM
The wasm32-wasip2 Target Has Reached Tier 2 Support
## Introduction In April of this year we posted an update about Rust's WASI targets to the main Rust blog. In it we covered the rename of the `wasm32-wasi` target to `wasm32-wasip1`, and the introduction of the new `wasm32-wasip2` target as a "tier 3" target. This meant that while the target was available as part of `rust-lang/rustc`, it was not guaranteed to build. We're pleased to announce that this has changed in Rust 1.82. For those unfamiliar with WebAssembly (Wasm) components and WASI 0.2, here is a quick, simplified primer: * **Wasm** is a (virtual) instruction format for programs to be compiled into (think: x86). * **Wasm Components** are a container format and type system that wrap Core Wasm instructions into typed, hermetic binaries and libraries (think: ELF). * **WASI** is a reserved namespace for a collection of standardized Wasm component interfaces (think: POSIX header files). For a more detailed explanation see the WASI 0.2 announcement post on the Bytecode Alliance blog. ## What's new? Starting Rust 1.82 (2024-10-17) the `wasm32-wasip2` (WASI 0.2) target has reached tier-2 platform support in the Rust compiler. Among other things this now means it is guaranteed to build, and is now available to install via Rustup using the following command: rustup target add wasm32-wasip2 Up until now Rust users writing Wasm Components would always have to rely on tools (such as cargo-component) which target the WASI 0.1 target (`wasm32-wasip1`) and package it into a WASI 0.2 Component via a post-processing step invoked. Now that `wasm32-wasip2` is available to everyone via Rustup, tooling can begin to directly target WASI 0.2 without the need for additional post-processing. What this also means is that ecosystem crates can begin targeting WASI 0.2 directly for platform-specific code. WASI 0.1 did not have support for sockets. Now that we have a stable tier 2 platform available, crate authors should be able to finally start writing WASI-compatible network code. To target WASI 0.2 from Rust, authors can use the following `cfg` attribute: #[cfg(all(target_os = "wasi", target_env = "p2"))] mod wasip2 { // items go here } To target the older WASI 0.1 target, Rust also accepts `target_env = "p1"`. ## Standard Library Support The WASI 0.2 Rust target reaching tier 2 platform support is in a way just the beginning. means it's supported and stable. While the platform itself is now stable, support in the stdlib for WASI 0.2 APIs is still limited. While the WASI 0.2 specification specifies APIs for example for timers, files, and sockets - if you try and use the stdlib APIs for these today, you'll find they don't yet work. We expect to gradually extend the Rust stdlib with support for WASI 0.2 APIs throughout the remainder of this year into the next. That work has already started, with rust-lang/rust#129638 adding native support for `std::net` in Rust 1.83. We expect more of these PRs to land through the remainder of the year. Though this doesn't need to stop users from using WASI 0.2 today. The stdlib is great because it provides _portable_ abstractions, usually built on top of an operating system's `libc` or equivalent. If you want to use WASI 0.2 APIs directly today, you can either use the wasi crate directly. Or generate your own WASI bindings from the WASI specification's interface types using wit-bindgen. ## Conclusion The `wasm32-wasip2` target is now installable via Rustup. This makes it possible for the Rust compiler to directly compile to the Wasm Components format targeting the WASI 0.2 interfaces. There is now also a way for crates to compile add WASI 0.2 platform support by writing: #[cfg(all(target_os = "wasi", target_env = "p2"))] mod wasip2 {} We're excited for Wasm Components and WASI 0.2 to have reached this milestone within the Rust project, and are excited to see what folks in the community will be building with it!
blog.rust-lang.org
December 14, 2024 at 4:22 PM
The wasm32-wasip2 Target Has Reached Tier 2 Support
## Introduction In April of this year we posted an update about Rust's WASI targets to the main Rust blog. In it we covered the rename of the `wasm32-wasi` target to `wasm32-wasip1`, and the introduction of the new `wasm32-wasip2` target as a "tier 3" target. This meant that while the target was available as part of `rust-lang/rustc`, it was not guaranteed to build. We're pleased to announce that this has changed in Rust 1.82. For those unfamiliar with WebAssembly (Wasm) components and WASI 0.2, here is a quick, simplified primer: * **Wasm** is a (virtual) instruction format for programs to be compiled into (think: x86). * **Wasm Components** are a container format and type system that wrap Core Wasm instructions into typed, hermetic binaries and libraries (think: ELF). * **WASI** is a reserved namespace for a collection of standardized Wasm component interfaces (think: POSIX header files). For a more detailed explanation see the WASI 0.2 announcement post on the Bytecode Alliance blog. ## What's new? Starting Rust 1.82 (2024-10-17) the `wasm32-wasip2` (WASI 0.2) target has reached tier-2 platform support in the Rust compiler. Among other things this now means it is guaranteed to build, and is now available to install via Rustup using the following command: rustup target add wasm32-wasip2 Up until now Rust users writing Wasm Components would always have to rely on tools (such as cargo-component) which target the WASI 0.1 target (`wasm32-wasip1`) and package it into a WASI 0.2 Component via a post-processing step invoked. Now that `wasm32-wasip2` is available to everyone via Rustup, tooling can begin to directly target WASI 0.2 without the need for additional post-processing. What this also means is that ecosystem crates can begin targeting WASI 0.2 directly for platform-specific code. WASI 0.1 did not have support for sockets. Now that we have a stable tier 2 platform available, crate authors should be able to finally start writing WASI-compatible network code. To target WASI 0.2 from Rust, authors can use the following `cfg` attribute: #[cfg(all(target_os = "wasi", target_env = "p2"))] mod wasip2 { // items go here } To target the older WASI 0.1 target, Rust also accepts `target_env = "p1"`. ## Standard Library Support The WASI 0.2 Rust target reaching tier 2 platform support is in a way just the beginning. means it's supported and stable. While the platform itself is now stable, support in the stdlib for WASI 0.2 APIs is still limited. While the WASI 0.2 specification specifies APIs for example for timers, files, and sockets - if you try and use the stdlib APIs for these today, you'll find they don't yet work. We expect to gradually extend the Rust stdlib with support for WASI 0.2 APIs throughout the remainder of this year into the next. That work has already started, with rust-lang/rust#129638 adding native support for `std::net` in Rust 1.83. We expect more of these PRs to land through the remainder of the year. Though this doesn't need to stop users from using WASI 0.2 today. The stdlib is great because it provides _portable_ abstractions, usually built on top of an operating system's `libc` or equivalent. If you want to use WASI 0.2 APIs directly today, you can either use the wasi crate directly. Or generate your own WASI bindings from the WASI specification's interface types using wit-bindgen. ## Conclusion The `wasm32-wasip2` target is now installable via Rustup. This makes it possible for the Rust compiler to directly compile to the Wasm Components format targeting the WASI 0.2 interfaces. There is now also a way for crates to compile add WASI 0.2 platform support by writing: #[cfg(all(target_os = "wasi", target_env = "p2"))] mod wasip2 {} We're excited for Wasm Components and WASI 0.2 to have reached this milestone within the Rust project, and are excited to see what folks in the community will be building with it!
blog.rust-lang.org
December 4, 2024 at 4:34 PM
The wasm32-wasip2 Target Has Reached Tier 2 Support
## Introduction In April of this year we posted an update about Rust's WASI targets to the main Rust blog. In it we covered the rename of the `wasm32-wasi` target to `wasm32-wasip1`, and the introduction of the new `wasm32-wasip2` target as a "tier 3" target. This meant that while the target was available as part of `rust-lang/rustc`, it was not guaranteed to build. We're pleased to announce that this has changed in Rust 1.82. For those unfamiliar with WebAssembly (Wasm) components and WASI 0.2, here is a quick, simplified primer: * **Wasm** is a (virtual) instruction format for programs to be compiled into (think: x86). * **Wasm Components** are a container format and type system that wrap Core Wasm instructions into typed, hermetic binaries and libraries (think: ELF). * **WASI** is a reserved namespace for a collection of standardized Wasm component interfaces (think: POSIX header files). For a more detailed explanation see the WASI 0.2 announcement post on the Bytecode Alliance blog. ## What's new? Starting Rust 1.82 (2024-10-17) the `wasm32-wasip2` (WASI 0.2) target has reached tier-2 platform support in the Rust compiler. Among other things this now means it is guaranteed to build, and is now available to install via Rustup using the following command: rustup target add wasm32-wasip2 Up until now Rust users writing Wasm Components would always have to rely on tools (such as cargo-component) which target the WASI 0.1 target (`wasm32-wasip1`) and package it into a WASI 0.2 Component via a post-processing step invoked. Now that `wasm32-wasip2` is available to everyone via Rustup, tooling can begin to directly target WASI 0.2 without the need for additional post-processing. What this also means is that ecosystem crates can begin targeting WASI 0.2 directly for platform-specific code. WASI 0.1 did not have support for sockets. Now that we have a stable tier 2 platform available, crate authors should be able to finally start writing WASI-compatible network code. To target WASI 0.2 from Rust, authors can use the following `cfg` attribute: #[cfg(all(target_os = "wasi", target_env = "p2"))] mod wasip2 { // items go here } To target the older WASI 0.1 target, Rust also accepts `target_env = "p1"`. ## Standard Library Support The WASI 0.2 Rust target reaching tier 2 platform support is in a way just the beginning. means it's supported and stable. While the platform itself is now stable, support in the stdlib for WASI 0.2 APIs is still limited. While the WASI 0.2 specification specifies APIs for example for timers, files, and sockets - if you try and use the stdlib APIs for these today, you'll find they don't yet work. We expect to gradually extend the Rust stdlib with support for WASI 0.2 APIs throughout the remainder of this year into the next. That work has already started, with rust-lang/rust#129638 adding native support for `std::net` in Rust 1.83. We expect more of these PRs to land through the remainder of the year. Though this doesn't need to stop users from using WASI 0.2 today. The stdlib is great because it provides _portable_ abstractions, usually built on top of an operating system's `libc` or equivalent. If you want to use WASI 0.2 APIs directly today, you can either use the wasi crate directly. Or generate your own WASI bindings from the WASI specification's interface types using wit-bindgen. ## Conclusion The `wasm32-wasip2` target is now installable via Rustup. This makes it possible for the Rust compiler to directly compile to the Wasm Components format targeting the WASI 0.2 interfaces. There is now also a way for crates to compile add WASI 0.2 platform support by writing: #[cfg(all(target_os = "wasi", target_env = "p2"))] mod wasip2 {} We're excited for Wasm Components and WASI 0.2 to have reached this milestone within the Rust project, and are excited to see what folks in the community will be building with it!
blog.rust-lang.org
November 27, 2024 at 1:38 PM