From 09bc0bfd1e60b8a57040868f0b440b4f0f41a65b Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sat, 24 Dec 2022 05:01:25 +0000 Subject: [PATCH] Allow enums with lifetime-only generics --- c-bindings-gen/src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/c-bindings-gen/src/main.rs b/c-bindings-gen/src/main.rs index 0e9a422..903ebfc 100644 --- a/c-bindings-gen/src/main.rs +++ b/c-bindings-gen/src/main.rs @@ -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(); -- 2.39.5