]> git.bitcoin.ninja Git - ldk-c-bindings/commitdiff
Check if types are understood before we map an impl block for them
authorMatt Corallo <git@bluematt.me>
Sun, 31 Oct 2021 23:32:55 +0000 (23:32 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 2 Nov 2021 16:54:45 +0000 (16:54 +0000)
c-bindings-gen/src/main.rs

index ea624e5fd10b6007379dffb3f9fd0c933f8c82d3..b88f37ffe9e306cc0ac83b5abfaa16d7118e0af1 100644 (file)
@@ -771,6 +771,11 @@ fn writeln_impl<W: std::io::Write>(w: &mut W, i: &syn::ItemImpl, types: &mut Typ
                if p.qself.is_some() { unimplemented!(); }
                if let Some(ident) = single_ident_generic_path_to_ident(&p.path) {
                        if let Some(resolved_path) = types.maybe_resolve_non_ignored_ident(&ident) {
+                               if !types.understood_c_path(&p.path) {
+                                       eprintln!("Not implementing anything for impl {} as the type is not understood (probably C-not exported)", ident);
+                                       return;
+                               }
+
                                let mut gen_types = GenericTypes::new(Some(resolved_path.clone()));
                                if !gen_types.learn_generics(&i.generics, types) {
                                        eprintln!("Not implementing anything for impl {} due to not understood generics", ident);