Check if named type requires a lifetime and conform if does
This commit is contained in:
@@ -19,7 +19,14 @@ pub(super) fn define_struct(
|
||||
let member_decls = s.members.iter().map(|m| {
|
||||
let name = names.struct_member(&m.name);
|
||||
let type_ = match &m.tref {
|
||||
witx::TypeRef::Name(nt) => names.type_(&nt.name),
|
||||
witx::TypeRef::Name(nt) => {
|
||||
let tt = names.type_(&nt.name);
|
||||
if m.tref.needs_lifetime() {
|
||||
quote!(#tt<'a>)
|
||||
} else {
|
||||
quote!(#tt)
|
||||
}
|
||||
},
|
||||
witx::TypeRef::Value(ty) => match &**ty {
|
||||
witx::Type::Builtin(builtin) => names.builtin_type(*builtin, quote!('a)),
|
||||
witx::Type::Pointer(pointee) | witx::Type::ConstPointer(pointee) => {
|
||||
|
||||
@@ -52,6 +52,10 @@ impl<'a> structs::Structs for WasiCtx<'a> {
|
||||
second: *second,
|
||||
})
|
||||
}
|
||||
|
||||
fn sum_array<'b>(&self, an_arr: &types::StructOfArray<'b>) -> Result<u16, types::Errno> {
|
||||
Ok(0)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
||||
Reference in New Issue
Block a user