Skip to content

Commit d5921f6

Browse files
committed
[bindings] Drop one static-lifetime restriction and check success
In general we should stop enforcing that all lifetimes are static - we may take references from C and its up to reviewing the diff on the bindings changes and the user(s) to ensure lifetimes are valid. Also asserts a success criteria that was missed before.
1 parent f01d3bf commit d5921f6

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

c-bindings-gen/src/types.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,7 +1674,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
16741674
write!(w, "#[no_mangle]\npub extern \"C\" fn {}_new(", mangled_container).unwrap();
16751675
for (idx, gen) in args.iter().enumerate() {
16761676
write!(w, "{}{}: ", if idx != 0 { ", " } else { "" }, ('a' as u8 + idx as u8) as char).unwrap();
1677-
self.write_c_type_intern(None, w, gen, false, false, false);
1677+
assert!(self.write_c_type_intern(None, w, gen, false, false, false));
16781678
}
16791679
writeln!(w, ") -> {} {{", mangled_container).unwrap();
16801680
writeln!(w, "\t{} {{", mangled_container).unwrap();
@@ -1963,9 +1963,6 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
19631963
self.write_c_path_intern(generics, w, &p.path, is_ref, is_mut, ptr_for_ref)
19641964
},
19651965
syn::Type::Reference(r) => {
1966-
if let Some(lft) = &r.lifetime {
1967-
if format!("{}", lft.ident) != "static" { return false; }
1968-
}
19691966
self.write_c_type_intern(generics, w, &*r.elem, true, r.mutability.is_some(), ptr_for_ref)
19701967
},
19711968
syn::Type::Array(a) => {

0 commit comments

Comments
 (0)