Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

Bump MSRV to 1.98.0 (#15252)

Alex Crichton49a7d064f46c
diff --git a/.github/actions/install-rust/action.yml b/.github/actions/install-rust/action.yml
index e4d4997477..97a14095f1 100644
--- a/.github/actions/install-rust/action.yml
+++ b/.github/actions/install-rust/action.yml
@@ -32,7 +32,7 @@ runs:
elif [ "${{ inputs.toolchain }}" = "msrv" ]; then
echo "version=1.$msrv.0" >> "$GITHUB_OUTPUT"
elif [ "${{ inputs.toolchain }}" = "wasmtime-ci-pinned-nightly" ]; then
- echo "version=nightly-2026-10-01" >> "$GITHUB_OUTPUT"
+ echo "version=nightly-2026-11-12" >> "$GITHUB_OUTPUT"
elif [ "${{ inputs.toolchain }}" = "wasmtime-ci-oss-fuzz-pin" ]; then
# Do not change this number unless OSS-Fuzz has updated. If you update
# this version and do not update OSS-Fuzz then you will break our
diff --git a/Cargo.toml b/Cargo.toml
index 10207f8d22..ef62926cb3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -59,7 +59,7 @@ doc = false
[dependencies]
wasmtime = { workspace = true, features = ['std'] }
wasmtime-cache = { workspace = true, optional = true }
-wasmtime-cli-flags = { workspace = true, features = ['clap', 'toml'] }
+wasmtime-cli-flags = { workspace = true, optional = true, features = ['clap', 'toml'] }
wasmtime-cranelift = { workspace = true, optional = true }
wasmtime-environ = { workspace = true }
wasmtime-explorer = { workspace = true, optional = true }
@@ -70,7 +70,7 @@ wasmtime-wasi-config = { workspace = true, optional = true }
wasmtime-wasi-tls = { workspace = true, optional = true }
wasmtime-wasi-keyvalue = { workspace = true, optional = true }
wasmtime-wasi-http = { workspace = true, optional = true }
-wasmtime-unwinder = { workspace = true }
+wasmtime-unwinder = { workspace = true, optional = true }
wasmtime-wizer = { workspace = true, optional = true, features = ['clap', 'wasmtime'] }
wasmtime-debugger = { workspace = true, optional = true }
gdbstub-component-artifact = { workspace = true, optional = true }
@@ -80,9 +80,9 @@ target-lexicon = { workspace = true }
wat = { workspace = true, optional = true }
serde = { workspace = true }
serde_derive = { workspace = true }
-serde_json = { workspace = true }
+serde_json = { workspace = true, optional = true }
wasmparser = { workspace = true }
-tracing = { workspace = true, features = ['std'] }
+tracing = { workspace = true, features = ['std'], optional = true }
log = { workspace = true }
tempfile = { workspace = true, optional = true }
object = { workspace = true, optional = true }
@@ -94,8 +94,8 @@ gimli = { workspace = true, optional = true }
pulley-interpreter = { workspace = true, optional = true }
smallvec = { workspace = true }
-async-trait = { workspace = true }
-bytes = { workspace = true }
+async-trait = { workspace = true, optional = true }
+bytes = { workspace = true, optional = true }
tokio = { workspace = true, optional = true, features = [ "signal", "macros" ] }
hyper = { workspace = true, optional = true }
hyper-util = { workspace = true, optional = true, features = ["server-auto"] }
@@ -105,7 +105,7 @@ futures = { workspace = true, optional = true }
pin-project-lite = { workspace = true, optional = true }
[target.'cfg(unix)'.dependencies]
-rustix = { workspace = true, features = ["mm", "process"] }
+rustix = { workspace = true, optional = true, features = ["mm", "process"] }
[dev-dependencies]
backtrace = { workspace = true }
@@ -119,6 +119,8 @@ criterion = { workspace = true }
num_cpus = "1.17.0"
memchr = "2.4"
async-trait = { workspace = true }
+bytes = { workspace = true }
+tracing = { workspace = true }
wat = { workspace = true }
rayon = "1.5.0"
wasmtime-wast = { workspace = true, features = ['component-model'] }
@@ -175,7 +177,7 @@ features = [
windows-sys = { workspace = true, features = ["Win32_System_Memory"] }
[target.'cfg(unix)'.dev-dependencies]
-rustix = { workspace = true, features = ["param"] }
+rustix = { workspace = true, features = ["mm", "param"] }
[profile.release.build-override]
opt-level = 0
@@ -228,7 +230,7 @@ authors = ["The Wasmtime Project Developers"]
edition = "2024"
# Wasmtime's current policy is that this number can be no larger than the
# current stable release of Rust minus 2.
-rust-version = "1.97.0"
+rust-version = "1.98.0"
[workspace.lints.rust]
# Turn on some lints which are otherwise allow-by-default in rustc.
@@ -547,20 +549,20 @@ default = [
#
# These features are off-by-default but may optionally be enabled.
all-arch = ["wasmtime/all-arch"]
-winch = ["wasmtime/winch"]
+winch = ["wasmtime/winch", "dep:wasmtime-cli-flags"]
wmemcheck = ["wasmtime/wmemcheck"]
trace-log = ["wasmtime/trace-log"]
-memory-protection-keys = ["wasmtime-cli-flags/memory-protection-keys"]
+memory-protection-keys = ["wasmtime-cli-flags?/memory-protection-keys"]
profile-pulley = ["wasmtime/profile-pulley"]
component-model-async = [
- "wasmtime-cli-flags/component-model-async",
+ "wasmtime-cli-flags?/component-model-async",
"component-model",
"wasmtime-wasi?/p3",
"wasmtime-wasi-http?/p3",
"wasmtime-wasi-tls?/p3",
"dep:futures",
]
-rr = ["wasmtime/rr", "component-model", "wasmtime-cli-flags/rr", "run"]
+rr = ["wasmtime/rr", "component-model", "wasmtime-cli-flags?/rr", "run"]
# Enabled in release builds. We cannot enable the built-in gdbstub component in
# the default build because the published-to-crates.io crates cannot build the
@@ -569,7 +571,7 @@ gdbstub = ["debug", "dep:gdbstub-component-artifact"]
# This feature, when enabled, will statically compile out all logging statements
# throughout Wasmtime and its dependencies.
-disable-logging = ["log/max_level_off", "tracing/max_level_off"]
+disable-logging = ["log/max_level_off", "dep:tracing", "tracing/max_level_off"]
# ========================================
# On-by-default features
@@ -581,35 +583,35 @@ wasi-tls = ["dep:wasmtime-wasi-tls"]
wasi-http = ["component-model", "dep:wasmtime-wasi-http", "dep:tokio", "dep:hyper", "wasmtime-wasi-http/default-send-request"]
wasi-config = ["dep:wasmtime-wasi-config"]
wasi-keyvalue = ["dep:wasmtime-wasi-keyvalue"]
-pooling-allocator = ["wasmtime/pooling-allocator", "wasmtime-cli-flags/pooling-allocator"]
+pooling-allocator = ["wasmtime/pooling-allocator", "wasmtime-cli-flags?/pooling-allocator"]
backtrace = ["wasmtime/backtrace"]
component-model = [
"wasmtime/component-model",
"wasmtime/wit-parser",
"wasmtime/anyhow",
"wasmtime-wast?/component-model",
- "wasmtime-cli-flags/component-model",
+ "wasmtime-cli-flags?/component-model",
"wasmtime-wizer?/component-model",
]
compile-time-builtins = ["component-model", "wasmtime/compile-time-builtins"]
wat = ["dep:wat", "wasmtime/wat"]
-cache = ["dep:wasmtime-cache", "wasmtime-cli-flags/cache"]
-parallel-compilation = ["wasmtime-cli-flags/parallel-compilation"]
-logging = ["wasmtime-cli-flags/logging"]
+cache = ["dep:wasmtime-cache", "wasmtime-cli-flags?/cache"]
+parallel-compilation = ["wasmtime-cli-flags?/parallel-compilation"]
+logging = ["wasmtime-cli-flags?/logging"]
demangle = ["wasmtime/demangle"]
-cranelift = ["wasmtime-cli-flags/cranelift", "dep:wasmtime-cranelift"]
+cranelift = ["dep:wasmtime-cli-flags", "wasmtime-cli-flags?/cranelift", "dep:wasmtime-cranelift", "dep:serde_json"]
profiling = ["wasmtime/profiling", "wasmtime/call-hook"]
-coredump = ["wasmtime-cli-flags/coredump"]
+coredump = ["wasmtime-cli-flags?/coredump"]
addr2line = ["wasmtime/addr2line"]
debug-builtins = ["wasmtime/debug-builtins"]
-threads = ["wasmtime-cli-flags/threads", "wasmtime-debugger?/threads"]
-gc = ["wasmtime-cli-flags/gc", "wasmtime/gc"]
-gc-drc = ["gc", "wasmtime/gc-drc", "wasmtime-cli-flags/gc-drc"]
-gc-null = ["gc", "wasmtime/gc-null", "wasmtime-cli-flags/gc-null"]
-gc-copying = ["gc", "wasmtime/gc-copying", "wasmtime-cli-flags/gc-copying"]
-pulley = ["wasmtime-cli-flags/pulley"]
-stack-switching = ["wasmtime/stack-switching", "wasmtime-cli-flags/stack-switching"]
-debug = ["wasmtime-cli-flags/debug", "wasmtime/debug", "component-model", "dep:wasmtime-debugger"]
+threads = ["wasmtime-cli-flags?/threads", "wasmtime-debugger?/threads"]
+gc = ["wasmtime-cli-flags?/gc", "wasmtime/gc"]
+gc-drc = ["gc", "wasmtime/gc-drc", "wasmtime-cli-flags?/gc-drc"]
+gc-null = ["gc", "wasmtime/gc-null", "wasmtime-cli-flags?/gc-null"]
+gc-copying = ["gc", "wasmtime/gc-copying", "wasmtime-cli-flags?/gc-copying"]
+pulley = ["wasmtime-cli-flags?/pulley"]
+stack-switching = ["wasmtime/stack-switching", "wasmtime-cli-flags?/stack-switching"]
+debug = ["wasmtime-cli-flags?/debug", "wasmtime/debug", "component-model", "dep:wasmtime-debugger"]
# CLI subcommands for the `wasmtime` executable. See `wasmtime $cmd --help`
# for more information on each subcommand.
@@ -621,11 +623,15 @@ serve = [
"dep:hyper-util",
"dep:http",
"dep:pin-project-lite",
- "wasmtime-cli-flags/async",
+ "dep:async-trait",
+ "dep:bytes",
+ "dep:rustix",
+ "dep:wasmtime-cli-flags",
+ "wasmtime-cli-flags?/async",
"wasmtime-wasi-http?/p2",
]
-explore = ["dep:wasmtime-explorer", "dep:tempfile"]
-wast = ["dep:wasmtime-wast"]
+explore = ["dep:wasmtime-explorer", "dep:tempfile", "dep:wasmtime-cli-flags"]
+wast = ["dep:wasmtime-wast", "dep:wasmtime-cli-flags"]
config = ["cache"]
compile = ["cranelift"]
run = [
@@ -633,15 +639,19 @@ run = [
"wasmtime/runtime",
"wasmtime/wave",
"dep:tokio",
- "wasmtime-cli-flags/runtime",
- "wasmtime-cli-flags/async",
+ "dep:rustix",
+ "dep:wasmtime-cli-flags",
+ "wasmtime-cli-flags?/runtime",
+ "wasmtime-cli-flags?/async",
"wasmtime-wasi-http?/p2",
]
completion = ["dep:clap_complete"]
objdump = [
'dep:object',
+ 'dep:wasmtime-unwinder',
'dep:cranelift-codegen',
'dep:capstone',
+ 'pulley-interpreter/std',
'dep:termcolor',
'dep:gimli',
'pulley-interpreter/disas',
@@ -650,13 +660,16 @@ hot-blocks = [
'dep:capstone',
'dep:tempfile',
'dep:wasmprinter',
+ 'dep:wasmtime-cli-flags',
]
wizer = [
"wasmtime-wizer",
"dep:wasmtime-wasi",
"dep:tokio",
"wasmtime/wave",
- "wasmtime-cli-flags/runtime",
+ "dep:rustix",
+ "dep:wasmtime-cli-flags",
+ "wasmtime-cli-flags?/runtime",
]
[[test]]
diff --git a/cranelift/filetests/src/function_runner.rs b/cranelift/filetests/src/function_runner.rs
index f671c841d3..d6d2759acb 100644
--- a/cranelift/filetests/src/function_runner.rs
+++ b/cranelift/filetests/src/function_runner.rs
@@ -787,7 +787,9 @@ fn lookup_libcall(name: &str) -> Option<*const u8> {
#[cfg(target_arch = "x86_64")]
use std::arch::x86_64::__m128i;
#[cfg(target_arch = "x86_64")]
-#[expect(
+// NB: when MSRV is 1.102 then delete this attribute as it no longer warns at
+// that point.
+#[allow(
improper_ctypes_definitions,
reason = "manually verified to work for now"
)]
diff --git a/crates/c-api/Cargo.toml b/crates/c-api/Cargo.toml
index c61951bb18..d6b42ae0fb 100644
--- a/crates/c-api/Cargo.toml
+++ b/crates/c-api/Cargo.toml
@@ -23,7 +23,7 @@ env_logger = { workspace = true, optional = true }
wasmtime = { workspace = true, features = ['runtime', 'std'] }
wasmtime-c-api-macros = { workspace = true }
log = { workspace = true }
-tracing = { workspace = true }
+tracing = { workspace = true, optional = true }
# Optional dependency for the `wat2wasm` API
wat = { workspace = true, optional = true }
@@ -48,7 +48,7 @@ parallel-compilation = ['wasmtime/parallel-compilation']
wasi = ['wasmtime-wasi', 'wasmtime-wasi-io', 'tokio', 'async-trait', 'bytes']
wasi-http = ['wasi', 'wasmtime-wasi-http']
logging = ['dep:env_logger']
-disable-logging = ["log/max_level_off", "tracing/max_level_off"]
+disable-logging = ["log/max_level_off", "dep:tracing", "tracing/max_level_off"]
coredump = ["wasmtime/coredump"]
addr2line = ["wasmtime/addr2line"]
demangle = ["wasmtime/demangle"]
diff --git a/crates/c-api/src/lib.rs b/crates/c-api/src/lib.rs
index 5d51729bb9..6aad1b4ae2 100644
--- a/crates/c-api/src/lib.rs
+++ b/crates/c-api/src/lib.rs
@@ -17,6 +17,11 @@
pub use wasmtime;
+// `tracing` is only a dependency to support the `disable-logging` feature, so
+// fake a use of it to quiet Cargo's `unused_dependencies` lint.
+#[cfg(feature = "disable-logging")]
+use tracing as _;
+
mod config;
mod engine;
mod error;
diff --git a/crates/environ/Cargo.toml b/crates/environ/Cargo.toml
index c92120ed86..aff0dec776 100644
--- a/crates/environ/Cargo.toml
+++ b/crates/environ/Cargo.toml
@@ -19,7 +19,7 @@ all-features = true
[dependencies]
anyhow = { workspace = true }
-postcard = { workspace = true }
+postcard = { workspace = true, optional = true }
cpp_demangle = { version = "0.5.1", default-features = false, features = ['alloc'], optional = true }
cranelift-entity = { workspace = true, features = ['enable-serde'] }
cranelift-bitset = { workspace = true, features = ['enable-serde'] }
@@ -30,7 +30,7 @@ indexmap = { workspace = true, features = ["serde"] }
serde = { workspace = true }
serde_derive = { workspace = true }
log = { workspace = true }
-gimli = { workspace = true }
+gimli = { workspace = true, optional = true }
object = { workspace = true }
rustc-demangle = { version = "0.1.16", default-features = false, optional = true }
target-lexicon = { workspace = true }
@@ -54,6 +54,7 @@ object = { workspace = true, features = ['unaligned'] }
arbtest = { workspace = true }
arbitrary = { workspace = true, features = ["derive"] }
mutatis = { workspace = true }
+postcard = { workspace = true }
[[example]]
name = "factc"
@@ -77,7 +78,9 @@ gc-drc = ["gc"]
gc-null = ["gc"]
gc-copying = ["gc"]
compile = [
+ 'dep:gimli',
'gimli/write',
+ 'dep:postcard',
'object/write_core',
'std',
"dep:wasm-encoder",
diff --git a/crates/jit-debug/Cargo.toml b/crates/jit-debug/Cargo.toml
index 6d74a979a8..a45c455cc1 100644
--- a/crates/jit-debug/Cargo.toml
+++ b/crates/jit-debug/Cargo.toml
@@ -18,13 +18,13 @@ cc = { workspace = true }
wasmtime-versioned-export-macros = { workspace = true }
[dependencies]
-object = { workspace = true, optional = true }
-wasmtime-versioned-export-macros = { workspace = true }
+wasmtime-versioned-export-macros = { workspace = true, optional = true }
[target.'cfg(target_os = "linux")'.dependencies]
rustix = { workspace = true, features = ["mm", "time"], optional = true }
+object = { workspace = true, optional = true }
[features]
std = []
-gdb_jit_int = []
+gdb_jit_int = ["dep:wasmtime-versioned-export-macros"]
perf_jitdump = ["rustix", "object", "std"]
diff --git a/crates/jit-icache-coherence/src/libc/riscv64_linux.rs b/crates/jit-icache-coherence/src/libc/riscv64_linux.rs
index 5a480c375f..d5c728cbf7 100644
--- a/crates/jit-icache-coherence/src/libc/riscv64_linux.rs
+++ b/crates/jit-icache-coherence/src/libc/riscv64_linux.rs
@@ -9,6 +9,9 @@ pub(crate) fn clear_cache(ptr: *const c_void, len: usize) -> Result<()> {
fn riscv_flush_icache(start: u64, end: u64) -> Result<()> {
cfg_select! {
feature = "one-core" => {
+ // Fake a use of the `libc` crate to consider it used both on this
+ // branch and in the branch below.
+ use libc as _;
use std::arch::asm;
let _ = (start, end);
unsafe {
diff --git a/crates/wasi-tls/Cargo.toml b/crates/wasi-tls/Cargo.toml
index 2a796af152..b5bc318b9a 100644
--- a/crates/wasi-tls/Cargo.toml
+++ b/crates/wasi-tls/Cargo.toml
@@ -16,8 +16,8 @@ all-features = true
[features]
default = ["p2", "p3", "rustls"]
-p2 = ["wasmtime-wasi/p2"]
-p3 = ["wasmtime-wasi/p3", "wasmtime/component-model-async", "tracing"]
+p2 = ["wasmtime-wasi/p2", "wasmtime"]
+p3 = ["wasmtime/component-model-async", "tracing", "tokio/sync", "wasmtime/component-model-bytes"]
rustls = ["dep:rustls", "dep:tokio-rustls", "dep:webpki-roots"]
nativetls = ["dep:native-tls", "dep:tokio-native-tls"]
openssl = ["dep:openssl", "dep:tokio-openssl"]
@@ -30,8 +30,8 @@ tokio = { workspace = true, features = [
"time",
"io-util",
] }
-wasmtime = { workspace = true, features = ["runtime", "component-model"] }
-wasmtime-wasi = { workspace = true }
+wasmtime = { workspace = true, optional = true, features = ["runtime", "component-model"] }
+wasmtime-wasi = { workspace = true, optional = true }
tracing = { workspace = true, optional = true }
tokio-rustls = { workspace = true, optional = true }
rustls = { workspace = true, optional = true }
@@ -43,6 +43,6 @@ openssl = { workspace = true, optional = true }
[dev-dependencies]
test-programs-artifacts = { workspace = true }
-wasmtime-wasi = { workspace = true }
+wasmtime-wasi = { workspace = true, features = ["p2", "p3"] }
tokio = { workspace = true, features = ["macros"] }
futures = { workspace = true }
diff --git a/crates/wasi/Cargo.toml b/crates/wasi/Cargo.toml
index 004c967adb..4667ea9257 100644
--- a/crates/wasi/Cargo.toml
+++ b/crates/wasi/Cargo.toml
@@ -43,11 +43,13 @@ env_logger = { workspace = true }
[target.'cfg(unix)'.dependencies]
rustix = { workspace = true, features = ["event", "fs", "net", "time"] }
-rustix-linux-procfs = "0.1.1"
[target.'cfg(target_os = "android")'.dependencies]
libc = { workspace = true }
+[target.'cfg(any(target_os = "android", target_os = "linux"))'.dependencies]
+rustix-linux-procfs = "0.1.1"
+
[target.'cfg(windows)'.dependencies]
rustix = { workspace = true, features = ["event", "net"] }
diff --git a/crates/wasmtime/Cargo.toml b/crates/wasmtime/Cargo.toml
index 9bd256f2f5..d80eed9e5f 100644
--- a/crates/wasmtime/Cargo.toml
+++ b/crates/wasmtime/Cargo.toml
@@ -26,17 +26,16 @@ wasmtime-unwinder = { workspace = true, optional = true }
wasmtime-winch = { workspace = true, optional = true }
wasmtime-component-macro = { workspace = true, optional = true }
wasmtime-component-util = { workspace = true, optional = true }
-wasmtime-versioned-export-macros = { workspace = true }
+wasmtime-versioned-export-macros = { workspace = true, optional = true }
wasmtime-wmemcheck = { workspace = true, optional = true }
wasmtime-core = { workspace = true, features = ['serde'] }
-pulley-interpreter = { workspace = true }
+pulley-interpreter = { workspace = true, optional = true }
target-lexicon = { workspace = true }
wasmparser = { workspace = true }
wasm-encoder = { workspace = true, optional = true }
wasm-wave = { workspace = true, optional = true }
wasm-compose = { workspace = true, optional = true }
wit-parser = { workspace = true, optional = true }
-libc = { workspace = true }
log = { workspace = true }
wat = { workspace = true, optional = true }
serde = { workspace = true }
@@ -48,7 +47,7 @@ rayon = { workspace = true, optional = true }
object = { workspace = true, features = ['unaligned'] }
async-trait = { workspace = true, optional = true }
encoding_rs = { version = "0.8.31", optional = true }
-bumpalo = { workspace = true }
+bumpalo = { workspace = true, optional = true }
fxprof-processed-profile = { version = "0.8.1", optional = true }
gimli = { workspace = true, optional = true }
addr2line = { workspace = true, optional = true }
@@ -90,6 +89,7 @@ memfd = { workspace = true, optional = true }
mach2 = { workspace = true, optional = true }
[target.'cfg(unix)'.dependencies]
+libc = { workspace = true, optional = true }
rustix = { workspace = true, optional = true, features = ["mm", "param"] }
[dev-dependencies]
@@ -203,6 +203,7 @@ profiling = [
"rustix/thread",
"dep:serde_json",
"std",
+ "runtime",
"wasmtime-jit-debug/perf_jitdump",
]
@@ -218,6 +219,7 @@ async = [
"dep:wasmtime-fiber",
"wasmtime-component-macro?/async",
"runtime",
+ "dep:async-trait",
]
# Enables support for the pooling instance allocation strategy
@@ -247,6 +249,7 @@ wmemcheck = [
"dep:wasmtime-wmemcheck",
"wasmtime-environ/wmemcheck",
"std",
+ "runtime",
]
# Enables detailed internal compiler logging via WASMTIME_LOG
@@ -271,11 +274,13 @@ runtime = [
"dep:smallvec",
"dep:mach2",
"dep:memfd",
- "dep:wasmtime-versioned-export-macros",
"dep:windows-sys",
"pulley-interpreter/interp",
"dep:wasmtime-unwinder",
- "dep:async-trait",
+ "dep:wasmtime-versioned-export-macros",
+ "dep:bumpalo",
+ "dep:libc",
+ "dep:rustix",
]
# Enable support for garbage collection-related things.
@@ -318,7 +323,7 @@ stack-switching = [
# Controls whether backtraces will attempt to parse DWARF information in
# WebAssembly modules and components to provide filenames and line numbers in
# stack traces.
-addr2line = ["dep:addr2line", "dep:gimli", "std"]
+addr2line = ["dep:addr2line", "dep:gimli", "std", "runtime"]
# Enables support for the Rust standard library, enabling APIs that require
# types and traits from Rust's `std` such as `Path` and `Error`.
@@ -332,10 +337,9 @@ std = [
'object/std',
'once_cell',
'wasmtime-fiber?/std',
- 'pulley-interpreter/std',
+ 'pulley-interpreter?/std',
'addr2line?/std',
- "dep:rustix",
- "wasmtime-jit-icache-coherence",
+ "dep:wasmtime-jit-icache-coherence",
"wasmtime-jit-debug?/std",
"futures?/std",
]
diff --git a/crates/wasmtime/src/lib.rs b/crates/wasmtime/src/lib.rs
index bf9a83374b..2b92ca88ec 100644
--- a/crates/wasmtime/src/lib.rs
+++ b/crates/wasmtime/src/lib.rs
@@ -409,6 +409,23 @@ extern crate alloc;
// `use crate::prelude::*;` everywhere else within this crate, for example.
use wasmtime_environ::prelude;
+// Cargo's `unused_dependencies` lint warns about dependencies that rustc never
+// used, but some dependencies are only used under a combination of Cargo
+// features which can't be expressed in `Cargo.toml`. Fake a use of them here to
+// keep the lint quiet:
+//
+// * `encoding_rs` and `wasmtime-component-macro` are only used with both the
+// `component-model` and `runtime` features.
+// * `wat` is only used with the `cranelift` or `winch` features.
+// * `wasmtime-jit-icache-coherence` is only used with both the `std` and
+// `runtime` features.
+#[cfg(feature = "std")]
+use wasmtime_jit_icache_coherence as _;
+#[cfg(feature = "wat")]
+use wat as _;
+#[cfg(feature = "component-model")]
+use {encoding_rs as _, wasmtime_component_macro as _};
+
// FIXME(#12069) should transition to OOM-handling versions of these collections
// for all internal usage instead of using abort-on-OOM versions. Once that's
// done this can be removed and the collections should be directly imported from
diff --git a/crates/wasmtime/src/runtime/vm.rs b/crates/wasmtime/src/runtime/vm.rs
index fef015a565..d1e43dd2a8 100644
--- a/crates/wasmtime/src/runtime/vm.rs
+++ b/crates/wasmtime/src/runtime/vm.rs
@@ -5,6 +5,11 @@
// selectively enabled here.
#![warn(clippy::cast_sign_loss)]
+// Whether `wasmtime-versioned-export-macros` is used depends on `build.rs`
+// computed cfgs which `Cargo.toml` can't take into account, so fake a use of it
+// here to force this to be considered used.
+use wasmtime_versioned_export_macros as _;
+
// Polyfill `std::simd::i8x16` etc. until they're stable.
#[cfg(all(target_arch = "x86_64", target_feature = "sse"))]
#[expect(non_camel_case_types, reason = "matching wasm conventions")]
diff --git a/crates/wasmtime/src/runtime/vm/interpreter_disabled.rs b/crates/wasmtime/src/runtime/vm/interpreter_disabled.rs
index e7bd948759..845833c6fc 100644
--- a/crates/wasmtime/src/runtime/vm/interpreter_disabled.rs
+++ b/crates/wasmtime/src/runtime/vm/interpreter_disabled.rs
@@ -12,6 +12,12 @@ use core::mem;
use core::ptr::NonNull;
use wasmtime_unwinder::Unwind;
+// The `pulley-interpreter` crate is always a dependency when the `runtime`
+// feature is enabled and `build.rs` decides whether it's actually used. Fake a
+// use of it here to quiet Cargo's `unused_dependencies` lint since our manifest
+// can't take into account the build-script logic.
+use pulley_interpreter as _;
+
pub struct Interpreter {
empty: Infallible,
}
diff --git a/crates/wasmtime/src/runtime/vm/sys/custom/mod.rs b/crates/wasmtime/src/runtime/vm/sys/custom/mod.rs
index 3e0b190d5b..6effdc92bd 100644
--- a/crates/wasmtime/src/runtime/vm/sys/custom/mod.rs
+++ b/crates/wasmtime/src/runtime/vm/sys/custom/mod.rs
@@ -10,6 +10,19 @@
#![warn(dead_code, unused_imports)]
+// These crates are used by the `unix` and `windows` backends, and there's no
+// way to express in `Cargo.toml` that they're unused when this custom backend is
+// used instead, so fake a use of them here to quiet Cargo's
+// `unused_dependencies` lint.
+#[cfg(target_vendor = "apple")]
+use mach2 as _;
+#[cfg(target_os = "linux")]
+use memfd as _;
+#[cfg(windows)]
+use windows_sys as _;
+#[cfg(unix)]
+use {libc as _, rustix as _};
+
#[cfg(has_virtual_memory)]
use crate::prelude::*;
diff --git a/crates/wasmtime/src/runtime/vm/sys/windows/vectored_exceptions.rs b/crates/wasmtime/src/runtime/vm/sys/windows/vectored_exceptions.rs
index e2f6315982..49743b9c07 100644
--- a/crates/wasmtime/src/runtime/vm/sys/windows/vectored_exceptions.rs
+++ b/crates/wasmtime/src/runtime/vm/sys/windows/vectored_exceptions.rs
@@ -144,7 +144,7 @@ impl Drop for TrapHandler {
"failed to remove exception handler: {}",
io::Error::last_os_error()
);
- libc::abort();
+ std::process::abort();
}
let rc = RemoveVectoredContinueHandler(self.continue_handler);
if rc == 0 {
@@ -152,7 +152,7 @@ impl Drop for TrapHandler {
"failed to remove continue handler: {}",
io::Error::last_os_error()
);
- libc::abort();
+ std::process::abort();
}
}
}
diff --git a/examples/min-platform/Cargo.toml b/examples/min-platform/Cargo.toml
index 3c2098b280..c695e9ec69 100644
--- a/examples/min-platform/Cargo.toml
+++ b/examples/min-platform/Cargo.toml
@@ -9,9 +9,12 @@ rust-version.workspace = true
workspace = true
[dependencies]
+wasmtime = { workspace = true, features = ['cranelift', 'wat'] }
+
+# The host only does anything on Linux, see `src/main.rs`.
+[target.'cfg(target_os = "linux")'.dependencies]
libloading = "0.8"
object = { workspace = true, features = ['std'] }
-wasmtime = { workspace = true, features = ['cranelift', 'wat'] }
[features]
default = ["wasi"]
diff --git a/pulley/Cargo.toml b/pulley/Cargo.toml
index 58ed092fa4..ce2c8e974c 100644
--- a/pulley/Cargo.toml
+++ b/pulley/Cargo.toml
@@ -15,13 +15,13 @@ workspace = true
[dependencies]
arbitrary = { workspace = true, optional = true }
cranelift-bitset = { workspace = true }
-log = { workspace = true }
wasmtime-core = { workspace = true, optional = true }
anyhow = { workspace = true, optional = true }
-pulley-macros = { workspace = true }
+pulley-macros = { workspace = true, optional = true }
[dev-dependencies]
env_logger = { workspace = true }
+log = { workspace = true }
anyhow = { workspace = true, features = ['std'] }
clap = { workspace = true }
termcolor = { workspace = true }
@@ -32,7 +32,7 @@ arbitrary = ["dep:arbitrary", "arbitrary/derive", "std", "cranelift-bitset/arbit
encode = []
decode = []
disas = ["decode"]
-interp = ["decode", "encode", "dep:wasmtime-core"]
+interp = ["decode", "encode", "dep:wasmtime-core", "dep:pulley-macros"]
profile = ['std', 'dep:anyhow']
[package.metadata.docs.rs]
diff --git a/src/lib.rs b/src/lib.rs
index 7476c852c4..70f4b72041 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -4,6 +4,22 @@
#![deny(missing_docs)]
+// Cargo's `unused_dependencies` lint warns about dependencies that rustc never
+// used, but some dependencies here are only used under a combination of
+// features (or only exist to enable features of transitive dependencies), which
+// can't be expressed in `Cargo.toml`. Fake a use of them here to keep the lint
+// quiet.
+//
+// * `tracing` is only a dependency to support the `disable-logging` feature.
+// * `wasmtime-debugger` and `gdbstub-component-artifact` are only used by the
+// `run` and `serve` subcommands.
+#[cfg(feature = "gdbstub")]
+use gdbstub_component_artifact as _;
+#[cfg(feature = "disable-logging")]
+use tracing as _;
+#[cfg(feature = "debug")]
+use wasmtime_debugger as _;
+
pub mod commands;
#[cfg(any(feature = "cranelift", feature = "winch"))]
diff --git a/tests/all/guest_debug/mod.rs b/tests/all/guest_debug/mod.rs
index 23a98716bc..5ac1c2b8d6 100644
--- a/tests/all/guest_debug/mod.rs
+++ b/tests/all/guest_debug/mod.rs
@@ -20,15 +20,7 @@ use wasmtime::{Result, bail, format_err};
/// Find the wasmtime binary built alongside the test binary.
fn wasmtime_binary() -> std::path::PathBuf {
- let mut me = std::env::current_exe().expect("current_exe specified");
- me.pop(); // chop off file name
- me.pop(); // chop off `deps`
- if cfg!(target_os = "windows") {
- me.push("wasmtime.exe");
- } else {
- me.push("wasmtime");
- }
- me
+ env!("CARGO_BIN_EXE_wasmtime").into()
}
/// Path to the wasm-aware LLDB.
diff --git a/tests/all/native_debug/gdb.rs b/tests/all/native_debug/gdb.rs
index c58cf4aac4..d84693a0f5 100644
--- a/tests/all/native_debug/gdb.rs
+++ b/tests/all/native_debug/gdb.rs
@@ -17,11 +17,7 @@ fn gdb_with_script(args: &[&str], script: &str) -> Result<String> {
cmd.arg("--args");
- let mut me = std::env::current_exe().expect("current_exe specified");
- me.pop(); // chop off the file name
- me.pop(); // chop off `deps`
- me.push("wasmtime");
- cmd.arg(me);
+ cmd.arg(env!("CARGO_BIN_EXE_wasmtime"));
cmd.args(args);
diff --git a/tests/all/native_debug/lldb.rs b/tests/all/native_debug/lldb.rs
index d70112751d..a95f192119 100644
--- a/tests/all/native_debug/lldb.rs
+++ b/tests/all/native_debug/lldb.rs
@@ -29,15 +29,7 @@ fn lldb_with_script(args: &[&str], script: &str) -> Result<String> {
let script_path = script_file.path().to_str().unwrap();
cmd.args(&["-s", &script_path]);
- let mut me = std::env::current_exe().expect("current_exe specified");
- me.pop(); // chop off the file name
- me.pop(); // chop off `deps`
- if cfg!(target_os = "windows") {
- me.push("wasmtime.exe");
- } else {
- me.push("wasmtime");
- }
- cmd.arg(me);
+ cmd.arg(env!("CARGO_BIN_EXE_wasmtime"));
cmd.arg("--");
cmd.args(args);