wit-bindgen
wit-bindgen copied to clipboard
Panic when processing type aliases to owned resource handles
Summary
wit-bindgen panics when processing WIT files that contain type aliases to resource handles (e.g., type my-handle = own<my-resource>).
Environment
- wit-bindgen version: 0.47.0
- Affected component: wit-bindgen-core
- OS: Ubuntu 22.04, x86-64
Steps to Reproduce
-
Create a minimal WIT file
Save the following as
test.wit:package poc:demo; interface db { resource database { constructor(); query: func(sql: string) -> string; } // Type alias to owned resource handle type db-handle = own<database>; connect: func() -> db-handle; } world test-world { export db; } -
Run wit-bindgen
wit-bindgen rust --out-dir /tmp/test test.wit -
Observe the panic
thread 'main' panicked at /home/runner/work/wit-bindgen/wit-bindgen/crates/core/src/lib.rs:183:39: handle types do not require definition note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace