bytecodealliance / bytecodealliance/wasmtime
wiggle: anonymous struct members
- Dominant language
- Rust
- Stars
- 18.6k
- Forks
- 1.8k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 126
Description
While investigating in #2050, I discovered that if I wrote `(field $data (array u8))` inside a witx `struct` then I would receive the following error:
```
2 │ error: proc macro panicked
3 │ --> crates/wasi-common/src/wasi.rs:6:1
4 │ |
5 │ 6 | / wiggle::from_witx!({
6 │ 7 | | witx: ["WASI/phases/snapshot/witx/wasi_snapshot_preview1.witx", "WASI/phases/ephemeral/witx/wasi_ephemeral_nn.witx"],
7 │ 8 | | ctx: WasiCtx,
8 │ 9 | | });
9 │ | |___^
10 │ |
11 │ = help: message: not implemented: other anonymous struct members: Value(Array(Value(Builtin(U8))))
```
(I added more verbose error messaging in e4abc2f to understand what was failing). I can avoid this error by adding a layer of indirection--`(typename $tensor_data (array u8))` and then `(field $data $tensor_data)`--but that was not immediately apparent to me 😄.
Two questions:
- Should this feature be implemented? I.e., there are no weird issues raised by adding it?
- Is there anything to think through before implementing it? What all needs to change?
Contributor guide
Assessment
This issue has not been assessed yet.