From c358de7979526421ebb18df376ee323a5dd6d96b Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 24 Nov 2021 18:07:57 +0000 Subject: [PATCH] Support `use self::...` statements as they are sometimes use for submodules --- c-bindings-gen/src/types.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index cd53752..f541701 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -415,6 +415,11 @@ impl<'mod_lifetime, 'crate_lft: 'mod_lifetime> ImportResolver<'mod_lifetime, 'cr for module in super_mod.split("::") { path.push(syn::PathSegment { ident: syn::Ident::new(module, Span::call_site()), arguments: syn::PathArguments::None }); } + } else if partial_path == "" && format!("{}", $ident) == "self" { + new_path = format!("{}{}", module_path, $path_suffix); + for module in module_path.split("::") { + path.push(syn::PathSegment { ident: syn::Ident::new(module, Span::call_site()), arguments: syn::PathArguments::None }); + } } else if partial_path == "" && format!("{}", $ident) == "crate" { new_path = format!("{}{}", crate_name, $path_suffix); let crate_name_ident = format_ident!("{}", crate_name); -- 2.30.2