From daa985855dc35dcf78e8f2d86a5f5bcf47ee59c0 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 4 May 2026 09:13:48 -0700 Subject: [PATCH] Warn about CLI usage of wasi-common or wasi-threads This commit adds a warning to the CLI for https://github.com/bytecodealliance/rfcs/pull/47 being merged to prepare any would-be users about the upcoming change. This is expected to be around for 2 versions of Wasmtime, 45.0.0 and 46.0.0, and in 47.0.0 the warning will become a hard error with the removal of `wasi-common` and `wasi-threads`. --- src/commands/run.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/commands/run.rs b/src/commands/run.rs index 2d69b41d819e..100ab696f01b 100644 --- a/src/commands/run.rs +++ b/src/commands/run.rs @@ -1121,6 +1121,18 @@ impl RunCommand { // are enabled, then use the historical preview1 // implementation. (Some(false), _) | (None, Some(true)) => { + let flag = if self.run.common.wasi.preview2 == Some(false) { + "-Spreview2=n" + } else { + "-Sthreads" + }; + eprintln!( + "\ +WARNING: the `{flag}` flag will be a hard error in Wasmtime 47.0.0 on 2026-07-20. \ +For more information see https://github.com/bytecodealliance/rfcs/pull/47 and \ +please reach out on Zulip with questions. + " + ); wasi_common::tokio::add_to_linker(linker, |host| { host.legacy_p1_ctx.as_mut().unwrap() })?;