]> git.bitcoin.ninja Git - ldk-c-bindings/commitdiff
Replace type resolution assertions with failures
authorMatt Corallo <git@bluematt.me>
Tue, 25 Apr 2023 17:14:37 +0000 (17:14 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 26 Apr 2023 00:07:48 +0000 (00:07 +0000)
Type resolution now supports failing, but some assertions are still
left over from when it didn't. Replace some of those which now fail
on LDK 0.0.115.

c-bindings-gen/src/types.rs

index c02b1dd2114fc377a4065a8323d7976774f01dc6..b92ca77c397c6d5af0b9e26098be36bafc527d72 100644 (file)
@@ -2685,10 +2685,16 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
                        } else if let syn::Type::Path(p_arg) = t {
                                if let Some(resolved) = self.maybe_resolve_path(&p_arg.path, generics) {
                                        if !self.is_primitive(&resolved) {
-                                               assert!(!is_ref); // We don't currently support outer reference types for non-primitive inners
+                                               if is_ref {
+                                                       // We don't currently support outer reference types for non-primitive inners
+                                                       return false;
+                                               }
                                        }
                                } else {
-                                       assert!(!is_ref); // We don't currently support outer reference types for non-primitive inners
+                                       if is_ref {
+                                               // We don't currently support outer reference types for non-primitive inners
+                                               return false;
+                                       }
                                }
                                if !self.write_c_type_intern(w, t, generics, false, false, false, true, true) { return false; }
                        } else {