bytecodealliance / bytecodealliance/wit-bindgen
Panic when processing type aliases to owned resource handles
- Dominant language
- Rust
- Stars
- 1.5k
- Forks
- 286
- Avg merge
- 6h 32m
- Merged PRs (30d)
- 19
Description
### Summary
wit-bindgen panics when processing WIT files that contain type aliases to resource handles (e.g., `type my-handle = own`).
### Environment
- **wit-bindgen version**: 0.47.0
- **Affected component:** wit-bindgen-core
- **OS**: Ubuntu 22.04, x86-64
### Steps to Reproduce
1. Create a minimal WIT file
Save the following as `test.wit`:
```wit
package poc:demo;
interface db {
resource database {
constructor();
query: func(sql: string) -> string;
}
// Type alias to owned resource handle
type db-handle = own;
connect: func() -> db-handle;
}
world test-world {
export db;
}
```
2. Run wit-bindgen
```bash
wit-bindgen rust --out-dir /tmp/test test.wit
```
3. 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
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.