From 7f4d9fcc3bb550089a4244c817e24bc853757365 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sun, 18 Apr 2021 00:43:21 +0000 Subject: [PATCH] Handle type resolution of `crate::thing` without a `use crate` --- c-bindings-gen/src/types.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index b0a410e..567cc7d 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -517,9 +517,7 @@ impl<'mod_lifetime, 'crate_lft: 'mod_lifetime> ImportResolver<'mod_lifetime, 'cr format!("::{}", seg.ident) }).collect(); let first_seg_str = format!("{}", first_seg.ident); - if first_seg_str == "std" { - Some(first_seg_str + &remaining) - } else if let Some((imp, _)) = self.imports.get(&first_seg.ident) { + if let Some((imp, _)) = self.imports.get(&first_seg.ident) { if remaining != "" { Some(imp.clone() + &remaining) } else { @@ -527,6 +525,8 @@ impl<'mod_lifetime, 'crate_lft: 'mod_lifetime> ImportResolver<'mod_lifetime, 'cr } } else if let Some(_) = self.priv_modules.get(&first_seg.ident) { Some(format!("{}::{}{}", self.module_path, first_seg.ident, remaining)) + } else if first_seg_str == "std" || self.dependencies.contains(&first_seg.ident) { + Some(first_seg_str + &remaining) } else { None } } } -- 2.39.5