From: Matt Corallo Date: Thu, 20 Jul 2023 22:51:01 +0000 (+0000) Subject: Handle all traits in type resolution, including no-export ones X-Git-Tag: v0.0.116.0^2~6 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=5aaf753ce9c1b52d2b8ae46c93b0e57e7ac0f4fc;p=ldk-c-bindings Handle all traits in type resolution, including no-export ones In the previous commit, we set up handling of no-export traits with only a single implementor. In order to utilize that, we need such traits to participate in type resolution, which we add support for here. --- diff --git a/c-bindings-gen/src/main.rs b/c-bindings-gen/src/main.rs index 0a1d22a..ad2690c 100644 --- a/c-bindings-gen/src/main.rs +++ b/c-bindings-gen/src/main.rs @@ -73,7 +73,7 @@ fn maybe_convert_trait_impl(w: &mut W, trait_path: &syn::Path let mut for_obj_vec = Vec::new(); types.write_c_type(&mut for_obj_vec, for_ty, Some(generics), false); full_obj_path = String::from_utf8(for_obj_vec).unwrap(); - assert!(full_obj_path.starts_with(TypeResolver::generated_container_path())); + if !full_obj_path.starts_with(TypeResolver::generated_container_path()) { return; } for_obj = full_obj_path[TypeResolver::generated_container_path().len() + 2..].into(); } @@ -945,9 +945,11 @@ fn writeln_impl(w: &mut W, w_uses: &mut HashSet ImportResolver<'mod_lifetime, 'cr } }, syn::Item::Trait(t) => { - match export_status(&t.attrs) { - ExportStatus::Export|ExportStatus::NotImplementable => { - if let syn::Visibility::Public(_) = t.vis { - declared.insert(t.ident.clone(), DeclType::Trait(t)); - } - }, - _ => continue, + if let syn::Visibility::Public(_) = t.vis { + declared.insert(t.ident.clone(), DeclType::Trait(t)); } }, syn::Item::Mod(m) => {