wasi-rs icon indicating copy to clipboard operation
wasi-rs copied to clipboard

`witx-bingen` generates incorrect lifetimes

Open abrown opened this issue 3 years ago • 1 comments

In regenerating the wasi-nn bindings from a WITX file using the latest version of witx-bingen on main, I found that it generated code that would not compile. The lifetimes of several fields seemed to be incorrect--under-specified--and the bindings would no longer compile. I manually made the following changes which seem to resolve the compilation failure.

 #[repr(C)]
 #[derive(Copy, Clone, Debug)]
-pub struct Tensor {
-    pub dimensions: TensorDimensions<'_>,
+pub struct Tensor<'a> {
+    pub dimensions: TensorDimensions<'a>,
     pub type_: TensorType,
-    pub data: TensorData<'_>,
+    pub data: TensorData<'a>,
 }
 pub type GraphBuilder<'a> = &'a [u8];
-pub type GraphBuilderArray<'a> = &'a [GraphBuilder<'_>];
+pub type GraphBuilderArray<'a> = &'a [GraphBuilder<'a>];
 pub type Graph = u32;

Is this fixable and where could this be fixed in witx-bindgen?

abrown avatar Aug 31 '22 17:08 abrown

cc: @pchickey?

abrown avatar Aug 31 '22 18:08 abrown