From 5f056966b2acfa789bcbd575abc657b06d91f68e Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sat, 24 Dec 2022 22:57:55 +0000 Subject: [PATCH] Use the resolved name, not original ident, for Vec naming This will be useful in the next commit when we rename `u5` to `U5` --- c-bindings-gen/src/types.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index b022f32..5ced910 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -2962,12 +2962,12 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { } else { let mut inner_c_ty = Vec::new(); assert!(self.write_c_path_intern(&mut inner_c_ty, &p.path, generics, true, false, ptr_for_ref, with_ref_lifetime, c_ty)); - if self.is_clonable(&String::from_utf8(inner_c_ty).unwrap()) { - if let Some(id) = p.path.get_ident() { - let mangled_container = format!("CVec_{}Z", id); - write!(w, "{}::{}", Self::generated_container_path(), mangled_container).unwrap(); - self.check_create_container(mangled_container, "Vec", vec![&*s.elem], generics, false) - } else { false } + let inner_ty_str = String::from_utf8(inner_c_ty).unwrap(); + if self.is_clonable(&inner_ty_str) { + let inner_ty_ident = inner_ty_str.rsplitn(2, "::").next().unwrap(); + let mangled_container = format!("CVec_{}Z", inner_ty_ident); + write!(w, "{}::{}", Self::generated_container_path(), mangled_container).unwrap(); + self.check_create_container(mangled_container, "Vec", vec![&*s.elem], generics, false) } else { false } } } else if let syn::Type::Reference(r) = &*s.elem { -- 2.39.5