Initial fixed-length list implementation#1277
Conversation
|
I have a newer version at https://github.com/cpetig/wit-bindgen/tree/work-in-progress which tests more in depth and also supports C++, I need to separate and clean up that one and then push it here for review. |
|
Also this requires bytecodealliance/wasmtime#10619 , and a very recent version of wasm-component-ld for the tests to pass. |
7f2f236 to
ed27ed6
Compare
ed27ed6 to
e7ce6f0
Compare
|
This is ready, but depends on bytecodealliance/wasmtime#10619 for successful tests. |
|
This still has a limitation: The generated Rust and C++ code can't handle non-Copy/POD types. For Functional Safety this isn't an issue as you need to avoid putting string or list into a fixed size array anyway, resources might still make some sense. I created #1501 to track this limitation. |
|
TODO: Check for correct usage of "fixed-length" over "fixed-size" |
e7ce6f0 to
4f86bd4
Compare
|
Second thought: The impact of the wasm-tools change will be identical (all code generators in wit-bindgen have to do a search and replace independently of whether this patch is merged or not). But it will create a conflict with this patch, so I guess it can be merged and then the other change can be discussed separately. |
|
The (discussion of the) rename in wasm-tools happens in bytecodealliance/wasm-tools#2421 |
alexcrichton
left a comment
There was a problem hiding this comment.
Let's go ahead and get this merged and renames/refactors can land in parallel
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
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
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
See WebAssembly/component-model#384 for the commit which added fixed size lists to the component model standard documents.