Support "linear writes" in Rust future bindings - #1306
Merged
alexcrichton merged 1 commit intoMay 27, 2025
Conversation
To account for WebAssembly/wasip3-prototyping#172 and WebAssembly/component-model#521 the Rust bindings need to take into account that a future writer cannot be dropped without actually writing something. To model this futures now must be created with a thunk that creates the default value to be sent. This value is only used if another value was not otherwise written. Closes bytecodealliance#1304
Member
Author
|
For now tests are "updated enough" to pass but I suspect that more tests will need to be updated once the host is also enforcing this. Notably I suspect some C tests will need to be updated. |
dicej
approved these changes
May 27, 2025
alexcrichton
enabled auto-merge
May 27, 2025 21:09
rvolosatovs
added a commit
to bytecodealliance/wrpc
that referenced
this pull request
Jun 23, 2026
Merge upstream wit-bindgen 0.42.0 into the vendored bindgen subtree. - Bump wit-bindgen-core 0.41 -> 0.42 and wit-parser 0.227 -> 0.230. - Adapt to the wit-parser 0.230 API break: `TypeDefKind` gained a `FixedSizeList(Type, u32)` variant. Handle it in the introspection async-path walk like a `List` (element indexed by a wildcard path), and add arms to the Rust and Go generators' type/codec matches. Full fixed-size-list code generation is not supported yet (upstream adds Rust support in bytecodealliance/wit-bindgen#1277, ported later at 0.52), so the generator arms panic with an "unsupported" message; no fixture exercises them. - Port upstream features bytecodealliance/wit-bindgen#1244 + bytecodealliance/wit-bindgen#1270 (`serde::Deserialize` for the bindgen config): gate `serde::Deserialize` derives on `Opts` (`serde(default, rename_all = "kebab-case")`) and `WithOption` (`rename_all = "kebab-case"`) behind a new optional `serde` feature, matching upstream. wRPC has neither `ExportKey`/`AsyncConfig`/`Ownership` config types nor an `async_` option, so only `Opts`/`WithOption` apply. Non-carries (not applicable to wRPC, dropped from the merge): - more `wit-bindgen test` subcommand backends (`crates/test/src/{csharp, moonbit}.rs`, `crates/test/LICENSE-*`) and the new `tests/runtime-async/` guest runtime test tree; wRPC keeps its own `wrpc-test` crate. - the async-task / futures-stream-ABI refactors (bytecodealliance/wit-bindgen#1233/bytecodealliance/wit-bindgen#1241/bytecodealliance/wit-bindgen#1249/bytecodealliance/wit-bindgen#1260/bytecodealliance/wit-bindgen#1264/ bytecodealliance/wit-bindgen#1268/bytecodealliance/wit-bindgen#1278/bytecodealliance/wit-bindgen#1279/bytecodealliance/wit-bindgen#1247/bytecodealliance/wit-bindgen#1240/bytecodealliance/wit-bindgen#1291/bytecodealliance/wit-bindgen#1306 etc.) and bytecodealliance/wit-bindgen#1214's canonical-ABI guest-code warning squashing do not apply to wRPC's transport-stub generator. rust codegen (237) and go codegen (79) tests pass; `cargo clippy --workspace` (and `--features serde`) and `cargo doc --workspace` are clean; wasmtime and all examples build. Assisted-by: claude:claude-opus-4-8 Upstream diff: bytecodealliance/wit-bindgen@v0.41.0...v0.42.0
rvolosatovs
added a commit
to bytecodealliance/wrpc
that referenced
this pull request
Jun 23, 2026
Merge upstream wit-bindgen 0.42.0 into the vendored bindgen subtree. - Bump wit-bindgen-core 0.41 -> 0.42 and wit-parser 0.227 -> 0.230. - Adapt to the wit-parser 0.230 API break: `TypeDefKind` gained a `FixedSizeList(Type, u32)` variant. Handle it in the introspection async-path walk like a `List` (element indexed by a wildcard path), and add arms to the Rust and Go generators' type/codec matches. Full fixed-size-list code generation is not supported yet (upstream adds Rust support in bytecodealliance/wit-bindgen#1277, ported later at 0.52), so the generator arms panic with an "unsupported" message; no fixture exercises them. - Port upstream features bytecodealliance/wit-bindgen#1244 + bytecodealliance/wit-bindgen#1270 (`serde::Deserialize` for the bindgen config): gate `serde::Deserialize` derives on `Opts` (`serde(default, rename_all = "kebab-case")`) and `WithOption` (`rename_all = "kebab-case"`) behind a new optional `serde` feature, matching upstream. wRPC has neither `ExportKey`/`AsyncConfig`/`Ownership` config types nor an `async_` option, so only `Opts`/`WithOption` apply. Non-carries (not applicable to wRPC, dropped from the merge): - more `wit-bindgen test` subcommand backends (`crates/test/src/{csharp, moonbit}.rs`, `crates/test/LICENSE-*`) and the new `tests/runtime-async/` guest runtime test tree; wRPC keeps its own `wrpc-test` crate. - the async-task / futures-stream-ABI refactors (bytecodealliance/wit-bindgen#1233/bytecodealliance/wit-bindgen#1241/bytecodealliance/wit-bindgen#1249/bytecodealliance/wit-bindgen#1260/bytecodealliance/wit-bindgen#1264/ bytecodealliance/wit-bindgen#1268/bytecodealliance/wit-bindgen#1278/bytecodealliance/wit-bindgen#1279/bytecodealliance/wit-bindgen#1247/bytecodealliance/wit-bindgen#1240/bytecodealliance/wit-bindgen#1291/bytecodealliance/wit-bindgen#1306 etc.) and bytecodealliance/wit-bindgen#1214's canonical-ABI guest-code warning squashing do not apply to wRPC's transport-stub generator. rust codegen (237) and go codegen (79) tests pass; `cargo clippy --workspace` (and `--features serde`) and `cargo doc --workspace` are clean; wasmtime and all examples build. Assisted-by: claude:claude-opus-4-8 Upstream diff: bytecodealliance/wit-bindgen@v0.41.0...v0.42.0
rvolosatovs
added a commit
to bytecodealliance/wrpc
that referenced
this pull request
Jun 23, 2026
Merge upstream wit-bindgen 0.42.0 into the vendored bindgen subtree. - Bump wit-bindgen-core 0.41 -> 0.42 and wit-parser 0.227 -> 0.230. - Adapt to the wit-parser 0.230 API break: `TypeDefKind` gained a `FixedSizeList(Type, u32)` variant. Handle it in the introspection async-path walk like a `List` (element indexed by a wildcard path), and add arms to the Rust and Go generators' type/codec matches. Full fixed-size-list code generation is not supported yet (upstream adds Rust support in bytecodealliance/wit-bindgen#1277, ported later at 0.52), so the generator arms panic with an "unsupported" message; no fixture exercises them. - Port upstream features bytecodealliance/wit-bindgen#1244 + bytecodealliance/wit-bindgen#1270 (`serde::Deserialize` for the bindgen config): gate `serde::Deserialize` derives on `Opts` (`serde(default, rename_all = "kebab-case")`) and `WithOption` (`rename_all = "kebab-case"`) behind a new optional `serde` feature, matching upstream. wRPC has neither `ExportKey`/`AsyncConfig`/`Ownership` config types nor an `async_` option, so only `Opts`/`WithOption` apply. Non-carries (not applicable to wRPC, dropped from the merge): - more `wit-bindgen test` subcommand backends (`crates/test/src/{csharp, moonbit}.rs`, `crates/test/LICENSE-*`) and the new `tests/runtime-async/` guest runtime test tree; wRPC keeps its own `wrpc-test` crate. - the async-task / futures-stream-ABI refactors (bytecodealliance/wit-bindgen#1233/bytecodealliance/wit-bindgen#1241/bytecodealliance/wit-bindgen#1249/bytecodealliance/wit-bindgen#1260/bytecodealliance/wit-bindgen#1264/ bytecodealliance/wit-bindgen#1268/bytecodealliance/wit-bindgen#1278/bytecodealliance/wit-bindgen#1279/bytecodealliance/wit-bindgen#1247/bytecodealliance/wit-bindgen#1240/bytecodealliance/wit-bindgen#1291/bytecodealliance/wit-bindgen#1306 etc.) and bytecodealliance/wit-bindgen#1214's canonical-ABI guest-code warning squashing do not apply to wRPC's transport-stub generator. rust codegen (237) and go codegen (79) tests pass; `cargo clippy --workspace` (and `--features serde`) and `cargo doc --workspace` are clean; wasmtime and all examples build. Assisted-by: claude:claude-opus-4-8 Upstream diff: bytecodealliance/wit-bindgen@v0.41.0...v0.42.0
psiegl
pushed a commit
to airbus-forks/wrpc
that referenced
this pull request
Jul 9, 2026
Merge upstream wit-bindgen 0.43.0 into the vendored bindgen subtree. - Bump wit-bindgen-core 0.42 -> 0.43 and wit-parser 0.230 -> 0.235 (no generator API churn this round). - Carry the new `tests/codegen/async-trait-function.wit` input (an exported resource with an `async func` method); wRPC generates it without changes (async functions are handled as their sync equivalents over the transport), so no skip-arm is needed. Non-carries (not applicable to wRPC, dropped from the merge): - another `wit-bindgen test` subcommand backend (`crates/test/src/cpp.rs`). - the async-ABI / future-stream refactors (bytecodealliance/wit-bindgen#1302/bytecodealliance/wit-bindgen#1315 future/stream ABI and names, bytecodealliance/wit-bindgen#1311 async trait function errors, bytecodealliance/wit-bindgen#1306 linear writes) and bytecodealliance/wit-bindgen@504dcd1a (disallow 0 in canonical-ABI `from_handle`) do not apply to wRPC's transport-stub generator. rust codegen (240) and go codegen (80) tests pass; `cargo clippy --workspace` and `cargo doc --workspace` are clean; wasmtime and all examples build. Assisted-by: claude:claude-opus-4-8 Upstream diff: bytecodealliance/wit-bindgen@v0.42.0...v0.43.0
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.
To account for WebAssembly/wasip3-prototyping#172 and WebAssembly/component-model#521 the Rust bindings need to take into account that a future writer cannot be dropped without actually writing something. To model this futures now must be created with a thunk that creates the default value to be sent. This value is only used if another value was not otherwise written.
Closes #1304