Allow `?Sized` bounds in some cases
[ldk-c-bindings] / c-bindings-gen / src / main.rs
index a7f7a1e3896b16941064d3d273c0a54b2aa25540..28cce19e9715067a150a194f496b7e27eb03e640 100644 (file)
@@ -532,7 +532,12 @@ fn writeln_trait<'a, 'b, W: std::io::Write>(w: &mut W, t: &'a syn::ItemTrait, ty
                                                                syn::TypeParamBound::Trait(tr) => {
                                                                        writeln!(w, "\ttype {} = crate::{};", t.ident, $type_resolver.resolve_path(&tr.path, Some(&gen_types))).unwrap();
                                                                        for bound in bounds_iter {
-                                                                               if let syn::TypeParamBound::Trait(_) = bound { panic!("11"); }
+                                                                               if let syn::TypeParamBound::Trait(t) = bound {
+                                                                                       // We only allow for `?Sized` here.
+                                                                                       if let syn::TraitBoundModifier::Maybe(_) = t.modifier {} else { panic!(); }
+                                                                                       assert_eq!(t.path.segments.len(), 1);
+                                                                                       assert_eq!(format!("{}", t.path.segments[0].ident), "Sized");
+                                                                               }
                                                                        }
                                                                        break;
                                                                },