From: Matt Corallo Date: Sat, 24 Dec 2022 22:57:55 +0000 (+0000) Subject: Use the resolved name, not original ident, for Vec naming X-Git-Tag: v0.0.113.0^2~7 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=5f056966b2acfa789bcbd575abc657b06d91f68e;p=ldk-c-bindings Use the resolved name, not original ident, for Vec naming This will be useful in the next commit when we rename `u5` to `U5` --- 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 {