From c049cc17f3fdffe5502c4c94ab0c535aa910eb72 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 3 Nov 2024 07:04:02 -0800 Subject: [PATCH] Remove the `wasm32-wasi` target from rustc This commit is the final step in the journey of renaming the historical `wasm32-wasi` target in the Rust compiler to `wasm32-wasip1`. Various steps in this journey so far have been: * 2023-04-03: rust-lang/compiler-team#607 - initial proposal for this rename * 2024-11-27: rust-lang/compiler-team#695 - amended schedule/procedure for rename * 2024-01-29: rust-lang/rust#120468 - initial introduction of `wasm32-wasip1` * 2024-06-18: rust-lang/rust#126662 - warn on usage of `wasm32-wasi` * 2024-11-08: this PR - remove the `wasm32-wasi` target The full transition schedule is in [this comment][comment] and is summarized with: * 2024-05-02: Rust 1.78 released with `wasm32-wasip1` target * 2024-09-05: Rust 1.81 released warning on usage of `wasm32-wasi` * 2025-01-09: Rust 1.84 to be released without the `wasm32-wasi` target This means that support on stable for the replacement target of `wasm32-wasip1` has currently been available for 6 months. Users have already seen warnings on stable for 2 months about usage of `wasm32-wasi` and stable users have another 2 months of warnings before the target is removed from stable. This commit is intended to be the final step in this transition so the source tree should no longer mention `wasm32-wasi` except in historical reference to the older name of the `wasm32-wasip1` target. [comment]: https://github.com/rust-lang/rust/pull/120468#issuecomment-1977878747 --- compiler/rustc_session/src/config.rs | 13 ------------- compiler/rustc_target/src/spec/mod.rs | 1 - .../rustc_target/src/spec/targets/wasm32_wasi.rs | 11 ----------- .../rustc_target/src/spec/targets/wasm32_wasip1.rs | 4 ++-- .../rustc_target/src/spec/targets/wasm32_wasip2.rs | 2 +- src/ci/docker/host-x86_64/dist-various-2/Dockerfile | 1 - src/doc/rustc/src/platform-support.md | 5 ++--- src/doc/rustc/src/platform-support/wasm32-wasip1.md | 4 ---- .../unstable-book/src/compiler-flags/wasm-c-abi.md | 2 +- src/tools/build-manifest/src/main.rs | 1 - src/tools/compiletest/src/header/tests.rs | 4 ---- tests/assembly/targets/targets-elf.rs | 3 --- tests/codegen/repr/transparent-opaque-ptr.rs | 6 +++--- 13 files changed, 9 insertions(+), 48 deletions(-) delete mode 100644 compiler/rustc_target/src/spec/targets/wasm32_wasi.rs diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index bb730592068..00c5e8b4123 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -1350,19 +1350,6 @@ pub fn build_target_config(early_dcx: &EarlyDiagCtxt, opts: &Options, sysroot: & early_dcx.early_warn(warning) } - // The `wasm32-wasi` target is being renamed to `wasm32-wasip1` as - // part of rust-lang/compiler-team#607 and - // rust-lang/compiler-team#695. Warn unconditionally on usage to - // raise awareness of the renaming. This code will be deleted in - // October 2024. - if opts.target_triple.tuple() == "wasm32-wasi" { - early_dcx.early_warn( - "the `wasm32-wasi` target is being renamed to \ - `wasm32-wasip1` and the `wasm32-wasi` target will be \ - removed from nightly in October 2024 and removed from \ - stable Rust in January 2025", - ) - } if !matches!(target.pointer_width, 16 | 32 | 64) { early_dcx.early_fatal(format!( "target specification was invalid: unrecognized target-pointer-width {}", diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 06408e0b210..c9f86e575a7 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -1806,7 +1806,6 @@ supported_targets! { ("wasm32-unknown-emscripten", wasm32_unknown_emscripten), ("wasm32-unknown-unknown", wasm32_unknown_unknown), ("wasm32v1-none", wasm32v1_none), - ("wasm32-wasi", wasm32_wasi), ("wasm32-wasip1", wasm32_wasip1), ("wasm32-wasip2", wasm32_wasip2), ("wasm32-wasip1-threads", wasm32_wasip1_threads), diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs deleted file mode 100644 index c317ebd9592..00000000000 --- a/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs +++ /dev/null @@ -1,11 +0,0 @@ -//! NB: This target is in the process of being renamed to -//! `wasm32-wasip1`. For more information see: -//! -//! * -//! * - -use crate::spec::Target; - -pub(crate) fn target() -> Target { - super::wasm32_wasip1::target() -} diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs index 89d0721bf35..1cd30f21bec 100644 --- a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs +++ b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs @@ -17,7 +17,7 @@ pub(crate) fn target() -> Target { options.os = "wasi".into(); options.env = "p1".into(); - options.add_pre_link_args(LinkerFlavor::WasmLld(Cc::Yes), &["--target=wasm32-wasi"]); + options.add_pre_link_args(LinkerFlavor::WasmLld(Cc::Yes), &["--target=wasm32-wasip1"]); options.pre_link_objects_self_contained = crt_objects::pre_wasi_self_contained(); options.post_link_objects_self_contained = crt_objects::post_wasi_self_contained(); @@ -47,7 +47,7 @@ pub(crate) fn target() -> Target { options.entry_name = "__main_void".into(); Target { - llvm_target: "wasm32-wasi".into(), + llvm_target: "wasm32-wasip1".into(), metadata: crate::spec::TargetMetadata { description: Some("WebAssembly with WASI".into()), tier: Some(2), diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs index bd6bba067ef..f06112160d1 100644 --- a/compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs +++ b/compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs @@ -1,5 +1,5 @@ //! The `wasm32-wasip2` target is the next evolution of the -//! wasm32-wasi target. While the wasi specification is still under +//! wasm32-wasip1 target. While the wasi specification is still under //! active development, the preview 2 iteration is considered an "island //! of stability" that should allow users to rely on it indefinitely. //! diff --git a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile index ece5f174d06..c40de76abbf 100644 --- a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile @@ -114,7 +114,6 @@ ENV CARGO_TARGET_AARCH64_UNKNOWN_FUCHSIA_RUSTFLAGS \ ENV TARGETS=x86_64-unknown-fuchsia ENV TARGETS=$TARGETS,aarch64-unknown-fuchsia ENV TARGETS=$TARGETS,wasm32-unknown-unknown -ENV TARGETS=$TARGETS,wasm32-wasi ENV TARGETS=$TARGETS,wasm32-wasip1 ENV TARGETS=$TARGETS,wasm32-wasip1-threads ENV TARGETS=$TARGETS,wasm32-wasip2 diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md index 04bb40d750c..500eaafb63f 100644 --- a/src/doc/rustc/src/platform-support.md +++ b/src/doc/rustc/src/platform-support.md @@ -192,8 +192,8 @@ target | std | notes [`thumbv8m.main-none-eabihf`](platform-support/thumbv8m.main-none-eabi.md) | * | Bare Armv8-M Mainline, hardfloat [`wasm32-unknown-emscripten`](platform-support/wasm32-unknown-emscripten.md) | ✓ | WebAssembly via Emscripten [`wasm32-unknown-unknown`](platform-support/wasm32-unknown-unknown.md) | ✓ | WebAssembly -`wasm32-wasi` | ✓ | WebAssembly with WASI (undergoing a [rename to `wasm32-wasip1`][wasi-rename]) -[`wasm32-wasip1`](platform-support/wasm32-wasip1.md) | ✓ | WebAssembly with WASI +[`wasm32-wasip1`](platform-support/wasm32-wasip1.md) | ✓ | WebAssembly with WASIp1 +[`wasm32-wasip2`](platform-support/wasm32-wasip2.md) | ✓ | WebAssembly with WASIp2 [`wasm32-wasip1-threads`](platform-support/wasm32-wasip1-threads.md) | ✓ | WebAssembly with WASI Preview 1 and threads [`wasm32v1-none`](platform-support/wasm32v1-none.md) | * | WebAssembly limited to 1.0 features and no imports [`x86_64-apple-ios`](platform-support/apple-ios.md) | ✓ | 64-bit x86 iOS @@ -377,7 +377,6 @@ target | std | host | notes `thumbv7a-pc-windows-msvc` | ✓ | | `thumbv7a-uwp-windows-msvc` | ✓ | | `thumbv7neon-unknown-linux-musleabihf` | ? | | Thumb2-mode Armv7-A Linux with NEON, musl 1.2.3 -[`wasm32-wasip2`](platform-support/wasm32-wasip2.md) | ✓ | | WebAssembly [`wasm64-unknown-unknown`](platform-support/wasm64-unknown-unknown.md) | ? | | WebAssembly [`x86_64-apple-tvos`](platform-support/apple-tvos.md) | ✓ | | x86 64-bit tvOS [`x86_64-apple-watchos-sim`](platform-support/apple-watchos.md) | ✓ | | x86 64-bit Apple WatchOS simulator diff --git a/src/doc/rustc/src/platform-support/wasm32-wasip1.md b/src/doc/rustc/src/platform-support/wasm32-wasip1.md index 0e4def6768d..e5e8d554ecf 100644 --- a/src/doc/rustc/src/platform-support/wasm32-wasip1.md +++ b/src/doc/rustc/src/platform-support/wasm32-wasip1.md @@ -98,10 +98,6 @@ the target with: rustup target add wasm32-wasip1 ``` -> **Note**: the `wasm32-wasip1` target is new and may only be available -> on nightly by the time you're reading this. If `wasm32-wasip1` isn't -> available on stable Rust then `wasm32-wasi` should be available instead. - Rust programs can be built for that target: ```text diff --git a/src/doc/unstable-book/src/compiler-flags/wasm-c-abi.md b/src/doc/unstable-book/src/compiler-flags/wasm-c-abi.md index 138a98dbe3d..bde4bf58133 100644 --- a/src/doc/unstable-book/src/compiler-flags/wasm-c-abi.md +++ b/src/doc/unstable-book/src/compiler-flags/wasm-c-abi.md @@ -4,7 +4,7 @@ This option controls whether Rust uses the spec-compliant C ABI when compiling for the `wasm32-unknown-unknown` target. This makes it possible to be ABI-compatible with all other spec-compliant Wasm -like Rusts `wasm32-wasi`. +like Rusts `wasm32-wasip1`. This compiler flag is perma-unstable, as it will be enabled by default in the future with no option to fall back to the old non-spec-compliant ABI. diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index 925cbfe09a4..39d9158a1ff 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -157,7 +157,6 @@ static TARGETS: &[&str] = &[ "thumbv8m.main-none-eabihf", "wasm32-unknown-emscripten", "wasm32-unknown-unknown", - "wasm32-wasi", "wasm32-wasip1", "wasm32-wasip1-threads", "wasm32-wasip2", diff --git a/src/tools/compiletest/src/header/tests.rs b/src/tools/compiletest/src/header/tests.rs index 0e735dc77c4..c79825e9e2a 100644 --- a/src/tools/compiletest/src/header/tests.rs +++ b/src/tools/compiletest/src/header/tests.rs @@ -583,10 +583,6 @@ fn wasm_special() { ("wasm32-unknown-emscripten", "emscripten", true), ("wasm32-unknown-emscripten", "wasm32", true), ("wasm32-unknown-emscripten", "wasm32-bare", false), - ("wasm32-wasi", "emscripten", false), - ("wasm32-wasi", "wasm32", true), - ("wasm32-wasi", "wasm32-bare", false), - ("wasm32-wasi", "wasi", true), ("wasm32-wasip1", "emscripten", false), ("wasm32-wasip1", "wasm32", true), ("wasm32-wasip1", "wasm32-bare", false), diff --git a/tests/assembly/targets/targets-elf.rs b/tests/assembly/targets/targets-elf.rs index 1857633a8bf..7d50647bed1 100644 --- a/tests/assembly/targets/targets-elf.rs +++ b/tests/assembly/targets/targets-elf.rs @@ -525,9 +525,6 @@ //@ revisions: wasm32v1_none //@ [wasm32v1_none] compile-flags: --target wasm32v1-none //@ [wasm32v1_none] needs-llvm-components: webassembly -//@ revisions: wasm32_wasi -//@ [wasm32_wasi] compile-flags: --target wasm32-wasi -//@ [wasm32_wasi] needs-llvm-components: webassembly //@ revisions: wasm32_wasip1 //@ [wasm32_wasip1] compile-flags: --target wasm32-wasip1 //@ [wasm32_wasip1] needs-llvm-components: webassembly diff --git a/tests/codegen/repr/transparent-opaque-ptr.rs b/tests/codegen/repr/transparent-opaque-ptr.rs index 4e7b38bca39..29c03f0d5d9 100644 --- a/tests/codegen/repr/transparent-opaque-ptr.rs +++ b/tests/codegen/repr/transparent-opaque-ptr.rs @@ -1,12 +1,12 @@ -//@ revisions: aarch64-linux aarch64-darwin wasm32-wasi +//@ revisions: aarch64-linux aarch64-darwin wasm32-wasip1 //@ compile-flags: -O -C no-prepopulate-passes //@[aarch64-linux] compile-flags: --target aarch64-unknown-linux-gnu //@[aarch64-linux] needs-llvm-components: aarch64 //@[aarch64-darwin] compile-flags: --target aarch64-apple-darwin //@[aarch64-darwin] needs-llvm-components: aarch64 -//@[wasm32-wasi] compile-flags: --target wasm32-wasi -//@[wasm32-wasi] needs-llvm-components: webassembly +//@[wasm32-wasip1] compile-flags: --target wasm32-wasip1 +//@[wasm32-wasip1] needs-llvm-components: webassembly // See ./transparent.rs // Some platforms pass large aggregates using immediate arrays in LLVMIR