From: Matt Corallo Date: Wed, 24 Nov 2021 18:07:57 +0000 (+0000) Subject: Support `use self::...` statements as they are sometimes use for submodules X-Git-Tag: v0.0.103.1^2~4 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=c358de7979526421ebb18df376ee323a5dd6d96b;p=ldk-c-bindings Support `use self::...` statements as they are sometimes use for submodules --- 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);