From 87b49686773385dda0317365567584e0a48f1bd0 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 28 Sep 2023 02:33:58 +0000 Subject: [PATCH] Handle type references which refer to a module defined in scope eg ``` mod module; fn a() -> module::Type { todo!() } ``` --- c-bindings-gen/src/types.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index 5f9e581..6a5f3e2 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -679,6 +679,8 @@ impl<'mod_lifetime, 'crate_lft: 'mod_lifetime> ImportResolver<'mod_lifetime, 'cr Some(first_seg_str + &remaining) } else if first_seg_str == "crate" { Some(self.crate_name.to_owned() + &remaining) + } else if self.library.modules.get(&format!("{}::{}", self.module_path, first_seg.ident)).is_some() { + Some(format!("{}::{}{}", self.module_path, first_seg.ident, remaining)) } else { None } } } -- 2.39.5