From 14e40078699863ba8e15dbcfd2cd163ae67e5e5f Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sun, 31 Oct 2021 18:13:00 +0000 Subject: [PATCH] Support `use crate::*` statements --- c-bindings-gen/src/types.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index 0cc4425..18f6a0c 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -410,6 +410,10 @@ 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) == "crate" { + new_path = format!("{}{}", crate_name, $path_suffix); + let crate_name_ident = format_ident!("{}", crate_name); + path.push(parse_quote!(#crate_name_ident)); } else if partial_path == "" && !dependencies.contains(&$ident) { new_path = format!("{}::{}{}", crate_name, $ident, $path_suffix); let crate_name_ident = format_ident!("{}", crate_name); -- 2.39.5