wit-bindgen 0.41#1343
Merged
Merged
Conversation
* feat(rust): do not yield to the host while guest tasks are ready Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * Update crates/guest-rust/rt/src/async_support.rs --------- Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> Co-authored-by: Joel Dice <joel.dice@fermyon.com>
* Update wasm-tools dependencies * Fixes from wasm-tools update to p3 support Fix the name and signature of various intrinsics in the Rust bindings generator for p3 support. This is detected by updating wasm-tools in the wasip3-prototyping repository which requires changes here. * minimal stub of waitable-set support This is temporary (and relies on the host to ignore the waitable-set parameter) until we have proper waitable-set support, which I'll work on soon. Signed-off-by: Joel Dice <joel.dice@fermyon.com> --------- Signed-off-by: Joel Dice <joel.dice@fermyon.com> Co-authored-by: Joel Dice <joel.dice@fermyon.com>
After #1176 there's no longer any need to store these values on the heap, so store them on the stack instead. This also updates to store params/results in an overlapping allocation which should be reasonable as it's local per-import and results are never written before parameters are read. (and params are never read after results are written).
…1199) This feature allows some variants and records to use types for which adding traits will cause compilation to fail, such as serde::Deserialize on wasi:io/streams. Variants and records are specified as they are listed in the wit file, i.e. in kebab case.
* Automatic adaption to 64bit architectures in guest code * prefer absolute path for core crate * fix rust codegen after merge
* Enable running the Csharp tests on linux Signed-off-by: James Sturtevant <jstur@microsoft.com> * fix ci Signed-off-by: James Sturtevant <jstur@microsoft.com> * We don't have native aot packages for macos avaliable Signed-off-by: James Sturtevant <jstur@microsoft.com> * Don't silently pass on macOS Instead just don't test on macos * Different github actions syntax --------- Signed-off-by: James Sturtevant <jstur@microsoft.com> Co-authored-by: Alex Crichton <alex@alexcrichton.com>
This has been unmaintained for quite some time now and has never reached feature parity with other backends. In preparation for #1192 this commit removes the teavm-java generator entirely with a "tombstone" left in the README about the last commit which had the code.
I have a hunch this is why C# is so slow (the modules are big and there's a lot of them and unoptimized Cranelift is very slow).
Forgotten from #1202
This commit removes the Go language generator from the wit-bindgen project. The Go bindings have been moved to a separate repository, and all Go-related code and tests have been deleted. This commit updates CLI to redirect users to the new Go bindings repository. The Go bindings can now be found at: https://github.com/bytecodealliance/go-modules Signed-off-by: Jiaxiao Zhou <duibao55328@gmail.com>
* [wit-bindgen-rust] cargo fix --edition * fix "unsafe op in unsafe fn" 2024 change * fix cargo fmt output * rust-xcrate-test: make edition="2024" to show bindings work in 2024 --------- Co-authored-by: Yosh <github@yosh.is>
* Add a `wit-bindgen test` subcommand As I've read more and more of the Rust async runtime support and other various bits and pieces I've wanted more and more the ability to easily write tests for guest interactions with the host. While I don't think it's feasible to generate arbitrary hosts I do think it's possible to do this much more easily than is done today with the testing support in this repository. In essence this commit is an implementation of #1161. The goal of this commit is to add a `wit-bindgen test` test suite runner. This test suite will be used to migrate all existing tests in this repository to this new framework. In the limit this is expected to make it easier to write tests (no Rust knowledge necessary), make it more flexible to write tests (now you can use raw `*.wat`), and additionally improve the quality of the test suite by making it more reusable. The reusability isn't the highest priority at this time as it's not clear what else would want to reuse this, but my hope is that this refactoring is at least a large-ish leap forward towards having a component model test suite of some kind eventually. * Add the p2 target * Add new crate to publish list * Update crate metadata * Add back in crate test * Don't prepare ignored languages * Actually fail the process if tests fail * Install wasmtime on CI too * Always install wasi-sdk for all deps (which is now just a bunch of deps too) * Migrate some more Rust codegen tests to the new framework * Improve rendering of errors in test subcommand Use one deduplicated method for showing a list of errors. * Remove warnings in generated Rust programs * More migrated Rust codegen tests Add in configuration to drop default bindings args, aka `--generate-all` in Rust. * Move Rust/C-specific tests to their own folder * Migrate another rust codegen test * Migrate Rust numbers test to new framework * Migrate numbers/wasm.c to new framework * Migrate the `wasm/lists.rs` test to the new framework * Migrate `lists/wasm.c` test to new framework * Update test docs * Beef up Rust support to pull in `futures` and support WASIp1 * The `futures` crate will be necessary for upcoming async tests. * Support for WASIp1 is required as `wasm32-wasip2` can't produce an async component natively as it's not new enough. * Test runner support is extended slightly to support passing runtime arguments, such as `-Wcomponent-model-async`. * Document test's `config.rs` * Enable debuginfo in Rust tests Helps symbolicate backtraces better. * Fixup some merge conflicts
* rust codegen tests: check with both edition 2021 and 2024 * Fixes to codegen to support 2024 edition make various extern C blocks unsafe, and their call sites unsafe all rust codegen tests pass for both edition 2021 and 2024. --------- Co-authored-by: Alex Crichton <alex@alexcrichton.com>
[automatically-tag-and-release-this-commit] Co-authored-by: Auto Release Process <auto-release-process@users.noreply.github.com>
rvolosatovs
commented
Jun 22, 2026
rvolosatovs
left a comment
Member
Author
There was a problem hiding this comment.
I would have expected this PR to match upstream testing strategy (using wit-bindgen test)
ef80f62 to
9973677
Compare
rvolosatovs
commented
Jun 23, 2026
9973677 to
f1b1274
Compare
Merge upstream wit-bindgen 0.41.0 into the vendored bindgen subtree. - Bump wit-bindgen-core 0.40 -> 0.41 (wit-parser stays 0.227). - Carry upstream's `gen` -> `r#gen` rename of the `InterfaceGenerator` field (and the `gen` locals in `lib.rs`) so `interface.rs`/`lib.rs` match upstream verbatim, including at the three `additional_derive_ignore` sites. - Port upstream feature bytecodealliance/wit-bindgen#1199 (`additional_derives_ignore`): variants and records named in this kebab-case list are excluded when applying `additional_derives`, so a type whose payload doesn't implement an added trait (e.g. a resource handle vs `serde::Deserialize`) keeps the bindings compiling. The macro half (`crates/wit-bindgen-rust-macro`) merged cleanly; reimplemented the generator half against wRPC's `Opts` (new `additional_derive_ignore` field + preamble log) and the three derive sites in `interface.rs` (record/variant/enum), each gated by `!additional_derive_ignore.contains(&name.to_kebab_case())`. - Make wRPC's value-codec decoder generation edition-2024-clean: drop the explicit `ref mut` bindings in the three generated decoder match patterns in `interface.rs` (the default binding mode yields `&mut` under both editions), so generated bindings compile under edition 2024 as well as 2021. This is validated by the dual-edition `verify` carried with the test subcommand below. - Carry upstream feature bytecodealliance/wit-bindgen#1192 (`wit-bindgen test` subcommand), vendored from upstream's `crates/test` into a new `wit-bindgen-wrpc-test` crate (`crates/wit-bindgen-test`) with the guest-Wasm-specific pieces removed. The CLI gains a `wit-bindgen-wrpc test` subcommand. `lib.rs`/`config.rs` track upstream verbatim (kept `deny_unknown_fields`); `rust.rs` keeps upstream's `Edition` enum and dual-edition `verify` (compiling generated bindings under both 2021 and 2024) but is host-adapted. Dropped as guest-Wasm: the C/WAT language backends and the custom external-runner (`crates/test/src/{c,wat, custom}.rs`), the wasmtime runner (`runner.rs`), and in `lib.rs` the wasm32 component compilation/`convert_p1_to_component`, `wasm-compose` composition and `wasmparser` validation. Codegen tests run the generic `tests/codegen/*.wit` inputs (replacing the `codegen_tests!` macro harness, so `crates/wit-bindgen-{rust,go}/tests/codegen.rs` are deleted). Runtime tests live under `tests/runtime/rust/<name>/` with `runner`+`test` worlds; since wRPC bindings are `Invoke`/`Serve` RPC stubs rather than guest components, the `runner` (client) and `test` (server) are linked into one host binary connected over an in-process TCP transport and run to completion, instead of being composed in a component runtime. `go.rs` is wRPC-specific (upstream has no Go backend at this version). bytecodealliance/wit-bindgen#1199's `custom-derives` test is ported here as a runtime test, behaviorally proving the derives apply (and that `ignoreme` is excluded), alongside ports of upstream's option tests (skip, with, with-types, with-option-generate, alternative-bitflags, gated-features, unused-types). The suite is driven under `cargo test` via `tests/bindgen.rs`, which invokes the subcommand through `CARGO_BIN_EXE_wit-bindgen-wrpc`. Non-carries (not applicable to wRPC, dropped from the merge): - upstream removed Go from its own tree (bytecodealliance/wit-bindgen#1195); wRPC keeps its own `wit-bindgen-go` generator. - canonical-ABI / component-async / wasm-export-attribute changes (bytecodealliance/wit-bindgen#1206/bytecodealliance/wit-bindgen#1205 rust 2024 edition export attrs, bytecodealliance/wit-bindgen#1163 64-bit guest adaption, bytecodealliance/wit-bindgen#1185 async stack args, bytecodealliance/wit-bindgen#1198 p3) do not apply to wRPC's transport-stub generator. `wit-bindgen-wrpc test` runs 172 codegen tests (86 WITs x rust/go, each rust case verified under editions 2021 and 2024) and the runtime tests green; the whole workspace builds; `cargo clippy --workspace` and `cargo doc --workspace` are clean. Assisted-by: claude:claude-opus-4-8 Upstream diff: bytecodealliance/wit-bindgen@v0.40.0...v0.41.0
f1b1274 to
245316d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge upstream wit-bindgen 0.41.0 into the vendored bindgen subtree.
gen->r#genrename of theInterfaceGeneratorfield (andthe
genlocals inlib.rs) sointerface.rs/lib.rsmatch upstreamverbatim, including at the three
additional_derive_ignoresites.additional_derives_ignore): variants and recordsnamed in this kebab-case list are excluded when applying
additional_derives,so a type whose payload doesn't implement an added trait (e.g. a resource
handle vs
serde::Deserialize) keeps the bindings compiling. The macro half(
crates/wit-bindgen-rust-macro) merged cleanly; reimplemented the generatorhalf against wRPC's
Opts(newadditional_derive_ignorefield + preamblelog) and the three derive sites in
interface.rs(record/variant/enum), eachgated by
!additional_derive_ignore.contains(&name.to_kebab_case()).explicit
ref mutbindings in the three generated decoder match patterns ininterface.rs(the default binding mode yields&mutunder both editions),so generated bindings compile under edition 2024 as well as 2021. This is
validated by the dual-edition
verifycarried with the test subcommand below.wit-bindgen testsubcommand wit-bindgen#1192 (wit-bindgen testsubcommand), vendored fromupstream's
crates/testinto a newwit-bindgen-wrpc-testcrate(
crates/wit-bindgen-test) with the guest-Wasm-specific pieces removed. TheCLI gains a
wit-bindgen-wrpc testsubcommand.lib.rs/config.rstrackupstream verbatim (kept
deny_unknown_fields);rust.rskeeps upstream'sEditionenum and dual-editionverify(compiling generated bindings underboth 2021 and 2024) but is host-adapted. Dropped as guest-Wasm: the C/WAT
language backends and the custom external-runner (
crates/test/src/{c,wat, custom}.rs), the wasmtime runner (runner.rs), and inlib.rsthe wasm32component compilation/
convert_p1_to_component,wasm-composecomposition andwasmparservalidation. Codegen tests run the generictests/codegen/*.witinputs (replacing the
codegen_tests!macro harness, socrates/wit-bindgen-{rust,go}/tests/codegen.rsare deleted). Runtime testslive under
tests/runtime/rust/<name>/withrunner+testworlds; since wRPCbindings are
Invoke/ServeRPC stubs rather than guest components, therunner(client) andtest(server) are linked into one host binary connectedover an in-process TCP transport and run to completion, instead of being
composed in a component runtime.
go.rsis wRPC-specific (upstream has no Gobackend at this version). feat: Allow variants and records to be ignored by additional_derives wit-bindgen#1199's
custom-derivestest is ported here as aruntime test, behaviorally proving the derives apply (and that
ignoremeisexcluded), alongside ports of upstream's option tests (skip, with, with-types,
with-option-generate, alternative-bitflags, gated-features, unused-types). The
suite is driven under
cargo testviatests/bindgen.rs, which invokes thesubcommand through
CARGO_BIN_EXE_wit-bindgen-wrpc.Non-carries (not applicable to wRPC, dropped from the merge):
wit-bindgen-gogenerator.rust 2024 edition export attrs, Automatic adaption to 64bit architectures in guest code wit-bindgen#1163 64-bit guest adaption, Store arguments for async params/results on the stack wit-bindgen#1185 async stack
args, Update support for p3 to match the latest wasm-tools wit-bindgen#1198 p3) do not apply to wRPC's transport-stub generator.
wit-bindgen-wrpc testruns 172 codegen tests (86 WITs x rust/go, each rust caseverified under editions 2021 and 2024) and the runtime tests green; the whole
workspace builds;
cargo clippy --workspaceandcargo doc --workspaceareclean.
Assisted-by: claude:claude-opus-4-8
Upstream diff: bytecodealliance/wit-bindgen@v0.40.0...v0.41.0