Ignore `Sized` bounds when processing generics
authorMatt Corallo <git@bluematt.me>
Mon, 12 Apr 2021 22:26:28 +0000 (18:26 -0400)
committerMatt Corallo <git@bluematt.me>
Thu, 15 Apr 2021 22:01:27 +0000 (18:01 -0400)
c-bindings-gen/src/types.rs

index edd993f9be137fa45d752dc51d01ba6538fc30eb..2cb93690095247845687370e2011220b3dda945f 100644 (file)
@@ -194,6 +194,7 @@ impl<'a, 'p: 'a> GenericTypes<'a, 'p> {
                                                        assert_simple_bound(&trait_bound);
                                                        if let Some(mut path) = types.maybe_resolve_path(&trait_bound.path, None) {
                                                                if types.skip_path(&path) { continue; }
                                                        assert_simple_bound(&trait_bound);
                                                        if let Some(mut path) = types.maybe_resolve_path(&trait_bound.path, None) {
                                                                if types.skip_path(&path) { continue; }
+                                                               if path == "Sized" { continue; }
                                                                if non_lifetimes_processed { return false; }
                                                                non_lifetimes_processed = true;
                                                                let new_ident = if path != "std::ops::Deref" {
                                                                if non_lifetimes_processed { return false; }
                                                                non_lifetimes_processed = true;
                                                                let new_ident = if path != "std::ops::Deref" {
@@ -223,6 +224,9 @@ impl<'a, 'p: 'a> GenericTypes<'a, 'p> {
                                                        let mut non_lifetimes_processed = false;
                                                        for bound in t.bounds.iter() {
                                                                if let syn::TypeParamBound::Trait(trait_bound) = bound {
                                                        let mut non_lifetimes_processed = false;
                                                        for bound in t.bounds.iter() {
                                                                if let syn::TypeParamBound::Trait(trait_bound) = bound {
+                                                                       if let Some(id) = trait_bound.path.get_ident() {
+                                                                               if format!("{}", id) == "Sized" { continue; }
+                                                                       }
                                                                        if non_lifetimes_processed { return false; }
                                                                        non_lifetimes_processed = true;
                                                                        assert_simple_bound(&trait_bound);
                                                                        if non_lifetimes_processed { return false; }
                                                                        non_lifetimes_processed = true;
                                                                        assert_simple_bound(&trait_bound);