From 04aae0e99236942f95211ab2f65de6c91d78193a Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 11 Feb 2021 11:39:21 -0500 Subject: [PATCH] [bindings] Resolve type aliases mapped as opaque types We already map type aliases which alias private types as opaque, but we don't resolve them like we would any other opaque type, preventing conversion printing or type use. --- c-bindings-gen/src/types.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index 4f5e4612c..ad9cd0497 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -383,6 +383,21 @@ impl<'mod_lifetime, 'crate_lft: 'mod_lifetime> ImportResolver<'mod_lifetime, 'cr } } }, + syn::Item::Type(t) if export_status(&t.attrs) == ExportStatus::Export => { + if let syn::Visibility::Public(_) = t.vis { + let mut process_alias = true; + for tok in t.generics.params.iter() { + if let syn::GenericParam::Lifetime(_) = tok {} + else { process_alias = false; } + } + if process_alias { + match &*t.ty { + syn::Type::Path(_) => { declared.insert(t.ident.clone(), DeclType::StructImported); }, + _ => {}, + } + } + } + }, syn::Item::Enum(e) => { if let syn::Visibility::Public(_) = e.vis { match export_status(&e.attrs) { -- 2.39.5