bytecodealliance/wasmtime

wiggle: anonymous struct members

Open

#2,055 建立於 2020年7月21日

在 GitHub 查看
 (3 留言) (0 反應) (0 負責人)Rust (1,531 fork)batch import
help wantedwasiwasi:impl

倉庫指標

Star
 (17,002 star)
PR 合併指標
 (平均合併 23小時 31分鐘) (30 天內合併 212 個 PR)

描述

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?

貢獻者指南