From e22aec2a1de57407095a1ed3696913309fca6545 Mon Sep 17 00:00:00 2001 From: Yosh Date: Mon, 8 Apr 2024 13:50:08 +0200 Subject: [PATCH 1/5] Create 2024-04-10-updates-to-rusts-wasi-targets.md --- ...024-04-10-updates-to-rusts-wasi-targets.md | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 posts/2024-04-10-updates-to-rusts-wasi-targets.md diff --git a/posts/2024-04-10-updates-to-rusts-wasi-targets.md b/posts/2024-04-10-updates-to-rusts-wasi-targets.md new file mode 100644 index 000000000..3826ef906 --- /dev/null +++ b/posts/2024-04-10-updates-to-rusts-wasi-targets.md @@ -0,0 +1,109 @@ +--- +layout: post +title: Changes to Rust's WASI targets +author: Yosh Wuyts +--- + +[WASI 0.2 was recently +stabilized](https://bytecodealliance.org/articles/WASI-0.2), and Rust has begun +implementing first-class support for it in the form of a dedicated new target. +In this post we'll discuss the introduction of the new target, what that means +for the older targets, and the schedule by which we plan to roll out these +changes. + +## Introducing `wasm32-wasip2` + +After nearly five years of work the [WASI 0.2 specification](https://wasi.dev) +was recently stabilized. This work builds on [WebAssembly +Components](https://component-model.bytecodealliance.org) (think: strongly-typed +ABI for Wasm), providing standard interfaces for things like asynchronous IO, +networking, and HTTP. This will finally make it possible to write asynchronous +networked services on top of WASI, something which wasn't possible using WASI +0.1. + +People interested in compiling Rust code to WASI 0.2 today are able to do so +using the [cargo-component](https://github.com/bytecodealliance/cargo-component) +tool. This tool is able to take WASI 0.1 binaries, and transform them to WASI 0.2 +Components using a shim. It also provides native support for common cargo +commands such as `cargo build`, `cargo test`, and `cargo run`. While it +introduces some inefficiencies because of the additional translation layer, in +practice this already works really well and people should be enough able to get +started with WASI 0.2 development. + +We're however keen to begin making that translation layer obsolete. And for +that reason we're happy to share that Rust has made its first steps towards +that with the introduction of the [tier +3](https://doc.rust-lang.org/rustc/platform-support.html#tier-3) `wasm32-wasip2` +target landing in Rust 1.78. **This will initially miss a lot of expected** +**features such as stdlib support, and we don't recommend people use this target** +**quite yet.** But as we fill in those missing features over the coming months, we +aim to eventually hit meet the criteria to become a tier 2 target, at which +point the `wasm32-wasip2` target would be considered ready for general use. This +work will happen through 2024, and we expect for this to land before the end of +the calendar year. + +## Renaming `wasm32-wasi` to `wasm32-wasip1` + +The original name for what we now call WASI 0.1 was "WebAssembly System +Interface, snapshot 1". Rust shipped support for this in 2019, and we did so +knowing the target would likely undergo significant changes in the future. With +the knowledge we have today though, we would not have chosen to introduce the +"WASI, snapshot 1" target as `wasm32-wasi`. We should have instead chosen to add +some suffix to the initial target triple so that the eventual stable WASI 1.0 +target can just be called `wasm32-wasi`. + +In anticipation of both an eventual WASI 1.0 target, and to preserve consistency +between target names, we'll begin rolling out a name change to the existing WASI +0.1 target. Starting in Rust 1.78 (May 2nd, 2024) a new `wasm32-wasip1` target +will become available. Starting Rust 1.81 we will begin warning existing users +of `wasm32-wasi` to migrate to `wasm32-wasip1`. And finally in Rust 1.84 +(January 9th, 2025) the `wasm32-wasi` target will no shipped on the stable +release channel. This will provide an 8 month transition period for projects to +switch to the new target name when they update their Rust toolchains. + +The name `wasip1` can be read as either "WASI (zero) point one" or "WASI preview +one". The official specification uses the "preview" moniker, however in most +communication the form "WASI 0.1" is now preferred. This target triple was +chosen because it not only maps to both terms, but also more closely resembles +the target terminology used in [other programming +languages](https://go.dev/blog/wasi). This is something the WASI Preview 2 +specification [also makes note +of](https://github.com/WebAssembly/WASI/tree/f45e72e5294e990c23d548eea32fd35c80525fd6/preview2#introduction). + +## Timeline + +This table provides the dates and cut-offs for the target rename from +`wasm32-wasi` to `wasm32-wasip1`. The dates in this table do not apply to the +newly-introduced `wasm32-wasi-preview1-threads` target; this will be renamed to +`wasm32-wasip1-threads` in Rust 1.78 without going through a transition period. +The tier 3 `wasm32-wasip2` target will also be made available in Rust 1.78. + +| date | Rust Stable | Rust Beta | Rust Nightly | Notes | +| ---------- | ----------- | --------- | ------------ | ---------------------------------------- | +| 2024-02-08 | 1.76 | 1.77 | 1.78 | `wasm32-wasip1` available on nightly | +| 2024-03-21 | 1.77 | 1.78 | 1.79 | `wasm32-wasip1` available on beta | +| 2024-05-02 | 1.78 | 1.79 | 1.80 | `wasm32-wasip1` available on stable | +| 2024-06-13 | 1.79 | 1.80 | 1.81 | warn if `wasm32-wasi` is used on nightly | +| 2024-07-25 | 1.80 | 1.81 | 1.82 | warn if `wasm32-wasi` is used on beta | +| 2024-09-05 | 1.81 | 1.82 | 1.83 | warn if `wasm32-wasi` is used on stable | +| 2024-10-17 | 1.82 | 1.83 | 1.84 | `wasm32-wasi` unavailable on nightly | +| 2024-11-28 | 1.83 | 1.84 | 1.85 | `wasm32-wasi` unavailable on beta | +| 2025-01-09 | 1.84 | 1.85 | 1.86 | `wasm32-wasi` unavailable on stable | + +## Conclusion + +In this post we've discussed the upcoming updates to Rust's WASI targets. Come +Rust 1.78 the `wasm32-wasip1` (tier 2) and `wasm32-wasip2` (tier 3) targets will +be added. In Rust 1.81 we will begin warning if `wasm32-wasi` is being used. And in Rust 1.84, the existing `wasm32-wasi` target will be removed. +Users will have 8 months to switch to the new target name when they update their +Rust toolchains. + +The `wasm32-wasip2` target marks the start of native support for WASI 0.2. In +order to target it today from Rust, people are encouraged to use +[cargo-component](https://github.com/bytecodealliance/cargo-component) tool +instead. The plan is to eventually graduate `wasm32-wasip2` to a tier-2 target, +at which point `cargo-component` will be upgraded to support it natively instead. + +With WASI 0.2 finally stable, it's an exciting time for WebAssembly development. +We're happy for Rust to begin implementing native support for WASI 0.2, and +we're excited for what this will enable people to build. From f2038658247edafbb69c73f264512eef756742c7 Mon Sep 17 00:00:00 2001 From: Yosh Date: Mon, 8 Apr 2024 14:01:16 +0200 Subject: [PATCH 2/5] Update posts/2024-04-10-updates-to-rusts-wasi-targets.md Co-authored-by: Christopher Serr --- posts/2024-04-10-updates-to-rusts-wasi-targets.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/posts/2024-04-10-updates-to-rusts-wasi-targets.md b/posts/2024-04-10-updates-to-rusts-wasi-targets.md index 3826ef906..fa85b0a4e 100644 --- a/posts/2024-04-10-updates-to-rusts-wasi-targets.md +++ b/posts/2024-04-10-updates-to-rusts-wasi-targets.md @@ -57,7 +57,7 @@ between target names, we'll begin rolling out a name change to the existing WASI 0.1 target. Starting in Rust 1.78 (May 2nd, 2024) a new `wasm32-wasip1` target will become available. Starting Rust 1.81 we will begin warning existing users of `wasm32-wasi` to migrate to `wasm32-wasip1`. And finally in Rust 1.84 -(January 9th, 2025) the `wasm32-wasi` target will no shipped on the stable +(January 9th, 2025) the `wasm32-wasi` target will no longer be shipped on the stable release channel. This will provide an 8 month transition period for projects to switch to the new target name when they update their Rust toolchains. From 5f13d05eb9cac95099f5ca4d231e1e3d1de28089 Mon Sep 17 00:00:00 2001 From: Yosh Date: Mon, 8 Apr 2024 20:13:37 +0200 Subject: [PATCH 3/5] Address feedback from review Co-Authored-By: Wesley Wiser --- ...2024-04-10-updates-to-rusts-wasi-targets.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/posts/2024-04-10-updates-to-rusts-wasi-targets.md b/posts/2024-04-10-updates-to-rusts-wasi-targets.md index fa85b0a4e..de1743cb4 100644 --- a/posts/2024-04-10-updates-to-rusts-wasi-targets.md +++ b/posts/2024-04-10-updates-to-rusts-wasi-targets.md @@ -55,11 +55,12 @@ target can just be called `wasm32-wasi`. In anticipation of both an eventual WASI 1.0 target, and to preserve consistency between target names, we'll begin rolling out a name change to the existing WASI 0.1 target. Starting in Rust 1.78 (May 2nd, 2024) a new `wasm32-wasip1` target -will become available. Starting Rust 1.81 we will begin warning existing users -of `wasm32-wasi` to migrate to `wasm32-wasip1`. And finally in Rust 1.84 -(January 9th, 2025) the `wasm32-wasi` target will no longer be shipped on the stable -release channel. This will provide an 8 month transition period for projects to -switch to the new target name when they update their Rust toolchains. +will become available. Starting Rust 1.81 (September 5th, 2024) we will begin +warning existing users of `wasm32-wasi` to migrate to `wasm32-wasip1`. And +finally in Rust 1.84 (January 9th, 2025) the `wasm32-wasi` target will no longer +be shipped on the stable release channel. This will provide an 8 month +transition period for projects to switch to the new target name when they update +their Rust toolchains. The name `wasip1` can be read as either "WASI (zero) point one" or "WASI preview one". The official specification uses the "preview" moniker, however in most @@ -94,9 +95,10 @@ The tier 3 `wasm32-wasip2` target will also be made available in Rust 1.78. In this post we've discussed the upcoming updates to Rust's WASI targets. Come Rust 1.78 the `wasm32-wasip1` (tier 2) and `wasm32-wasip2` (tier 3) targets will -be added. In Rust 1.81 we will begin warning if `wasm32-wasi` is being used. And in Rust 1.84, the existing `wasm32-wasi` target will be removed. -Users will have 8 months to switch to the new target name when they update their -Rust toolchains. +be added. In Rust 1.81 we will begin warning if `wasm32-wasi` is being used. And +in Rust 1.84, the existing `wasm32-wasi` target will be removed. This will free +up `wasm32-wasi` to eventually be used for a WASI 1.0 target. Users will have 8 +months to switch to the new target name when they update their Rust toolchains. The `wasm32-wasip2` target marks the start of native support for WASI 0.2. In order to target it today from Rust, people are encouraged to use From f2baed3cb99b5bc5858a64c204de346fd52da415 Mon Sep 17 00:00:00 2001 From: Yosh Date: Mon, 8 Apr 2024 20:45:52 +0200 Subject: [PATCH 4/5] unbury the lead Co-Authored-By: Ryan Levick --- posts/2024-04-10-updates-to-rusts-wasi-targets.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/posts/2024-04-10-updates-to-rusts-wasi-targets.md b/posts/2024-04-10-updates-to-rusts-wasi-targets.md index de1743cb4..079077930 100644 --- a/posts/2024-04-10-updates-to-rusts-wasi-targets.md +++ b/posts/2024-04-10-updates-to-rusts-wasi-targets.md @@ -7,9 +7,18 @@ author: Yosh Wuyts [WASI 0.2 was recently stabilized](https://bytecodealliance.org/articles/WASI-0.2), and Rust has begun implementing first-class support for it in the form of a dedicated new target. -In this post we'll discuss the introduction of the new target, what that means -for the older targets, and the schedule by which we plan to roll out these -changes. +Rust 1.78 will introduce new `wasm32-wasip1` (tier 2) and `wasm32-wasip2` (tier +3) targets. `wasm32-wasip1` is an effective rename of the existing `wasm32-wasi` +target, freeing the target name up for an eventual WASI 1.0 release. **Starting +Rust 1.78 (May 2nd, 2024), users of WASI 0.1 are encouraged to begin migrating +to the new `wasm32-wasip1` target before the existing `wasm32-wasi` target is +removed in Rust 1.84 (January 5th, 2025).** + +In this post we'll discuss the introduction of the new targets, the motivation +behind it, what that means for the existing WASI targets, and a detailed +schedule for these changes. This post is about the WASI targets only; the +existing `wasm32-unknown-unknown` and `wasm32-unknown-emscripten` targets are +unaffected by any changes in this post. ## Introducing `wasm32-wasip2` From 861355e4a089ed75631342ac4cb42a06d4b20d74 Mon Sep 17 00:00:00 2001 From: Yosh Date: Tue, 9 Apr 2024 14:55:36 +0200 Subject: [PATCH 5/5] Change WASI post date to 2024-04-09 --- ...asi-targets.md => 2024-04-09-updates-to-rusts-wasi-targets.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename posts/{2024-04-10-updates-to-rusts-wasi-targets.md => 2024-04-09-updates-to-rusts-wasi-targets.md} (100%) diff --git a/posts/2024-04-10-updates-to-rusts-wasi-targets.md b/posts/2024-04-09-updates-to-rusts-wasi-targets.md similarity index 100% rename from posts/2024-04-10-updates-to-rusts-wasi-targets.md rename to posts/2024-04-09-updates-to-rusts-wasi-targets.md