]> git.bitcoin.ninja Git - ldk-c-bindings/commitdiff
Allow enums with lifetime-only generics
authorMatt Corallo <git@bluematt.me>
Sat, 24 Dec 2022 05:01:25 +0000 (05:01 +0000)
committerMatt Corallo <git@bluematt.me>
Sat, 24 Dec 2022 22:59:55 +0000 (22:59 +0000)
c-bindings-gen/src/main.rs

index 0e9a42286a1434ef6a8e3ea4f8c60356277c658e..903ebfc5089f05217e13412af677cb4999ef7e14 100644 (file)
@@ -849,7 +849,8 @@ fn writeln_struct<'a, 'b, W: std::io::Write>(w: &mut W, s: &'a syn::ItemStruct,
                                write!(w, "\t}}").unwrap();
                        },
                        syn::Fields::Unnamed(fields) => {
-                               assert!(s.generics.lt_token.is_none());
+                               assert!(!s.generics.params.iter()
+                                       .any(|gen| if let syn::GenericParam::Lifetime(_) = gen { false } else { true }));
                                writeln!(w, "{} (", types.maybe_resolve_ident(&s.ident).unwrap()).unwrap();
                                for (idx, field) in fields.unnamed.iter().enumerate() {
                                        write!(w, "\t\t").unwrap();