]> git.bitcoin.ninja Git - ldk-c-bindings/commitdiff
Allow `Sized` bounds
authorMatt Corallo <git@bluematt.me>
Tue, 26 Sep 2023 00:35:27 +0000 (00:35 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 26 Sep 2023 00:35:27 +0000 (00:35 +0000)
There was no reason to only allow `Sized`, rustc will let us know
if something is wrong.

c-bindings-gen/src/main.rs
c-bindings-gen/src/types.rs

index bca6aa5c02bdf0307043fe3ff1c6f9a755da3016..9f3727d0486992ba15e8f2d0b7ebfb3a6b8e3080 100644 (file)
@@ -534,8 +534,7 @@ fn writeln_trait<'a, 'b, W: std::io::Write>(w: &mut W, t: &'a syn::ItemTrait, ty
                                                                        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(t) = bound {
-                                                                                       // We only allow for `?Sized` here.
-                                                                                       if let syn::TraitBoundModifier::Maybe(_) = t.modifier {} else { panic!(); }
+                                                                                       // We only allow for `Sized` here.
                                                                                        assert_eq!(t.path.segments.len(), 1);
                                                                                        assert_eq!(format!("{}", t.path.segments[0].ident), "Sized");
                                                                                }
index 0ff81f8132d81f748045b080c1f7932b7cfa6992..6d97ccc32ffb10357bf020c2eefe8c56bea01b78 100644 (file)
@@ -354,7 +354,6 @@ impl<'a, 'p: 'a> GenericTypes<'a, 'p> {
                                                                for bound in bounds_iter {
                                                                        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");
                                                                        }