Hello! I'm upgrading everything to the latest, final preview2 version, and in that process I noticed that the latest (0.16.0) version of wit-bindgen no longer generates proper Drop functions for the resource types.
I have a test component that uses wasi-http bindings from go (basically a test built around this: https://github.com/golemcloud/go-wasi-http). With 0.14.0 this roundtrip.go file compiled and worked correctly. With the latest version it fails because all the .Drop() calls are now undefined.
If I check the generated C and go files, I see that in the C files we have the necessary functions, for example:
__attribute__((__import_module__("wasi:io/streams@0.2.0"), __import_name__("[resource-drop]output-stream")))
extern void __wasm_import_wasi_io_0_2_0_streams_output_stream_drop(int32_t handle);
void wasi_io_0_2_0_streams_output_stream_drop_own(wasi_io_0_2_0_streams_own_output_stream_t handle) {
__wasm_import_wasi_io_0_2_0_streams_output_stream_drop(handle.__handle);
}
but there is no corresponding `Drop()` function for `WasiIo0_2_0_StreamsOutputStream` in the generated Go file.
void wasi_io_0_2_0_streams_output_stream_drop_borrow(wasi_io_0_2_0_streams_own_output_stream_t handle) {
__wasm_import_wasi_io_0_2_0_streams_output_stream_drop(handle.__handle);
}
I was trying to find what change could cause it between 0.14.0 and 0.16.0, but could not find it yet. Also I've found that there are test cases that expect a Drop
function to be generated so I'm not sure what's going on.
Sorry, I was not exactly precise with saying it worked well with 0.14.0 - in fact it was tested with 3433f2d8515dd9eba95fd3ad581f5c389ae9dd1f
which is newer.
diff between using latest wit-bindgen@0.16.0 with WITs from wasmtime 17 vs wit-bindgen@3433f2 with WITs from wasmtime 15
Ah never mind. I just realized that 0.16.0 is an older release from December :man_facepalming:
Got confused by all the different versions of all the components and tools. sorry.
Daniel Vigovszky has marked this topic as resolved.
not at all! in nov and dec the wit versions and impls were flying fast and furious....
Oh hey, yeah I added the Drop()
functions after the latest release version. We need to get a new release.
Ping @Alex Crichton
Sure yeah, I posted https://github.com/bytecodealliance/wit-bindgen/pull/830 for that
Last updated: Dec 23 2024 at 12:05 UTC