From c7aad71b219cc74944c0700e8d342f5d67bb4bd1 Mon Sep 17 00:00:00 2001 From: Ben Visness Date: Wed, 7 Oct 2026 20:25:07 -0500 Subject: [PATCH 1/3] Bump wasm-tools to 261 (for accessor support) --- Cargo.lock | 28 ++++++++++++++-------------- Cargo.toml | 8 ++++---- src/lib.rs | 3 ++- tests/all.rs | 20 +++++++++++++++----- 4 files changed, 35 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 39935f7..2ab3907 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -416,9 +416,9 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.258.0" +version = "0.261.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e974fe6821a8cf64575d51ea2194e2c8f77e7b66e9afe7419ce8a97f9ee0d251" +checksum = "2608e8bb6d67fd68f5a8d0eb1363d6e7bcbc1f8ded5a0bd3a1e382462b876b22" dependencies = [ "leb128fmt", "wasmparser", @@ -426,9 +426,9 @@ dependencies = [ [[package]] name = "wasm-metadata" -version = "0.258.0" +version = "0.261.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a11585adb92fe9b55ad1d760e8d8fb5d87e0d2e303cb8eed57f078d54293a2" +checksum = "b88de21560ecd49deb8d8f1616b9b695f66fc312c5eca503f43accdc5795339e" dependencies = [ "anyhow", "indexmap", @@ -438,9 +438,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.258.3" +version = "0.261.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9269dd817e0e7021bf534ccd9761bc2d64778b6708e41228b8439d75eaa0b1" +checksum = "4f20f20e44f7e8aeb6744823ea9d869ede51e51be4fdaedede2852282e54d2d8" dependencies = [ "bitflags", "hashbrown", @@ -451,9 +451,9 @@ dependencies = [ [[package]] name = "wast" -version = "258.0.0" +version = "261.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97f7defc7ecca8b19ac7f824598eadd0c53985ee00c74060d65051e9da5b58a1" +checksum = "776443145731a4062e5b0d392892a2005909b6ab72d9fdc3cad53dd1a714e44a" dependencies = [ "bumpalo", "leb128fmt", @@ -464,9 +464,9 @@ dependencies = [ [[package]] name = "wat" -version = "1.258.0" +version = "1.261.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7555c008cca87f2ac58d9f83ccda7e7b44611093ce28eb28f052e7c78024b9bf" +checksum = "a7b4d1a49ea73a8f3326e74e3a05db667001b16bd1035ed3356fc1a0ed05ca7f" dependencies = [ "wast", ] @@ -494,9 +494,9 @@ checksum = "3ab703352da6a72f35c39a533526393725640575bb211f61987a2748323ad956" [[package]] name = "wit-component" -version = "0.258.0" +version = "0.261.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "481b5c47b2ecce0389b5e08a05557d6a190c9cd761773b8880a8017ee04dc7ef" +checksum = "2818766842bd2321074c348fb5c15d8fdb105a9eb78374e6d77c7d4127e1f2f9" dependencies = [ "anyhow", "bitflags", @@ -513,9 +513,9 @@ dependencies = [ [[package]] name = "wit-parser" -version = "0.258.3" +version = "0.261.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72a2127663dcf3ee16614fb0e3c33d5c6c66fec9dad317a8b0fdd3869487a533" +checksum = "962e43c4db2da607b50839a531e5b63473268b40efdf8028d5c54b572ca4f6f6" dependencies = [ "anyhow", "hashbrown", diff --git a/Cargo.toml b/Cargo.toml index 9bfd60b..14a5ce2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,10 +29,10 @@ clap = { version = "4.6.1", features = ['derive'] } clap_lex = "1.1.0" lexopt = "0.3.2" tempfile = "3.23.0" -wasmparser = "0.258.0" -wat = "1.257.0" -wit-component = "0.258.0" -wit-parser = "0.258.0" +wasmparser = "0.261.0" +wat = "1.261.0" +wit-component = "0.261.0" +wit-parser = "0.261.0" wasi-preview1-component-adapter-provider = "49.0.1" [target.'cfg(unix)'.dependencies] diff --git a/src/lib.rs b/src/lib.rs index 25022fc..f55c8cb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,4 @@ -use anyhow::{bail, Context, Result}; +use anyhow::{Context, Result, bail}; use clap::{ArgAction, CommandFactory, FromArgMatches}; use clap_lex::OsStrExt; use lexopt::Arg; @@ -696,6 +696,7 @@ impl App { &resolve, world, self.component.string_encoding, + false, )?; } diff --git a/tests/all.rs b/tests/all.rs index 052a4d6..dc480be 100644 --- a/tests/all.rs +++ b/tests/all.rs @@ -1,4 +1,4 @@ -use anyhow::{bail, Context, Result}; +use anyhow::{Context, Result, bail}; use std::env; use std::fs; use std::io::Write; @@ -77,7 +77,9 @@ impl Project { fn assert_component(bytes: &[u8]) { assert!(wasmparser::Parser::is_component(&bytes)); - wasmparser::Validator::new().validate_all(&bytes).unwrap(); + wasmparser::Validator::new_with_features(wasmparser::WasmFeatures::all()) + .validate_all(&bytes) + .unwrap(); } fn assert_module(bytes: &[u8]) { @@ -208,6 +210,7 @@ package foo:bar; interface foo { bar: func(s: string) -> string; + baz: get() -> s32; } world root { @@ -235,15 +238,22 @@ pub extern "C" fn cabi_realloc(ptr: *mut u8, old_size: i32, align: i32, new_size #[link(wasm_import_module = "foo:bar/foo")] extern "C" { #[link_name = "bar"] - fn import(ptr: *mut u8, len: i32, return_ptr: *mut *mut u8); + fn import1(ptr: *mut u8, len: i32, return_ptr: *mut *mut u8); + #[link_name = "[get]baz"] + fn import2() -> i32; } #[export_name = "foo:bar/foo#bar"] -pub unsafe extern "C" fn export(ptr: *mut u8, len: i32) -> *mut u8 { +pub unsafe extern "C" fn export1(ptr: *mut u8, len: i32) -> *mut u8 { let mut result = std::ptr::null_mut(); - import(ptr, len, &mut result); + import1(ptr, len, &mut result); result } + +#[export_name = "foo:bar/foo#[get]baz"] +pub unsafe extern "C" fn export2() -> i32 { + import2() +} "#, ); assert_component(&output); From a3b846a7b0de968c2a9abb4146e2c215ce9a65fa Mon Sep 17 00:00:00 2001 From: Ben Visness Date: Wed, 7 Oct 2026 20:26:49 -0500 Subject: [PATCH 2/3] Revert formatting nonsense... --- src/lib.rs | 2 +- tests/all.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f55c8cb..7e1c5b7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,4 @@ -use anyhow::{Context, Result, bail}; +use anyhow::{bail, Context, Result}; use clap::{ArgAction, CommandFactory, FromArgMatches}; use clap_lex::OsStrExt; use lexopt::Arg; diff --git a/tests/all.rs b/tests/all.rs index dc480be..15d4ae6 100644 --- a/tests/all.rs +++ b/tests/all.rs @@ -1,4 +1,4 @@ -use anyhow::{Context, Result, bail}; +use anyhow::{bail, Context, Result}; use std::env; use std::fs; use std::io::Write; From 968136110334215d77f893caad6ec1fafbbf7e50 Mon Sep 17 00:00:00 2001 From: Ben Visness Date: Wed, 7 Oct 2026 20:30:39 -0500 Subject: [PATCH 3/3] Bump MSRV to 1.88.0 (required by wasm-tools 261) --- .github/workflows/main.yml | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e5dddc6..402388c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -100,7 +100,7 @@ jobs: with: submodules: true - name: Install Rust (rustup) - run: rustup update 1.85.0 --no-self-update && rustup default 1.85.0 + run: rustup update 1.88.0 --no-self-update && rustup default 1.88.0 - run: cargo build rustfmt: diff --git a/Cargo.toml b/Cargo.toml index 14a5ce2..74d400d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ license = "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT" description = "Linker for `wasm32-wasip2`" repository = "https://github.com/bytecodealliance/wasm-component-ld" readme = "README.md" -rust-version = "1.85.0" +rust-version = "1.88.0" [package.metadata.binstall] pkg-url = "{repo}/releases/download/v{version}/{name}-v{version}-{target-arch}-{target-family}{archive-suffix}"