From 3a9500828833fa20d8d8c44eea4ed05342187fa9 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sun, 31 Oct 2021 23:32:55 +0000 Subject: [PATCH] Check if types are understood before we map an impl block for them --- c-bindings-gen/src/main.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/c-bindings-gen/src/main.rs b/c-bindings-gen/src/main.rs index ea624e5..b88f37f 100644 --- a/c-bindings-gen/src/main.rs +++ b/c-bindings-gen/src/main.rs @@ -771,6 +771,11 @@ fn writeln_impl(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); -- 2.39.5