bytecodealliance/wasmtime

wiggle: anonymous struct members

Open

#2055 opened on Jul 21, 2020

View on GitHub
 (3 comments) (0 reactions) (0 assignees)Rust (17,002 stars) (1,531 forks)batch import
help wantedwasiwasi:impl

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