about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2024-06-19 13:04:59 +0200
committerGitHub <noreply@github.com>2024-06-19 13:04:59 +0200
commitca61d7470a4def7a044d3e22731ec100585d26d4 (patch)
tree001c9d78d2f6eea2d4fd364ebe206bc0e3c99e91
parentcbf9d57e89a4dc756b27d22053d19f98f99e06f0 (diff)
parente003a12ad540835083bcefdb77f65bb94ca24279 (diff)
downloadrust-ca61d7470a4def7a044d3e22731ec100585d26d4.tar.gz
rust-ca61d7470a4def7a044d3e22731ec100585d26d4.zip
Rollup merge of #126662 - alexcrichton:warn-on-wasm32-wasi, r=michaelwoerister
Unconditionally warn on usage of `wasm32-wasi`

This commit is a continuation of the work originally proposed in rust-lang/compiler-team#607 and later amended in
rust-lang/compiler-team#695. The end goal is to rename `wasm32-wasi` to `wasm32-wasip1` to reflect WASI's development and distinguish the preexisting target from the `wasm32-wasip2` target that WASI is now developing. Work for this transition began in #120468 which landed in Rust 1.78 which became stable on 2024-05-02.

This implements the next phase of the transition plan to warn on usage of `wasm32-wasi`. This is intended to help alert users that a removal is pending and all release channels have the replacement available as well. This will reach stable on 2024-09-05. The next stage of the plan is to remove the `wasm32-wasi` target some time in October 2024 which means that the removal will reach stable on 2025-01-09. For reference a full schedule of this transition is listed [here].

Currently this implementation is a simple unconditional warning whenever `rustc --target wasm32-wasi` is invoked. As-implemented there's no way to turn off the warning other than to switch to the `wasm32-wasip1` target.

[here]: https://github.com/rust-lang/rust/pull/120468#issuecomment-1977878747
-rw-r--r--compiler/rustc_session/src/config.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs
index 5f9c3a14d60..24143808ef4 100644
--- a/compiler/rustc_session/src/config.rs
+++ b/compiler/rustc_session/src/config.rs
@@ -1311,6 +1311,20 @@ pub fn build_target_config(early_dcx: &EarlyDiagCtxt, opts: &Options, sysroot: &
             for warning in warnings.warning_messages() {
                 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.triple() == "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 {}",