From e260a5e4cc1ea727fa32aa6e61c0e0f4e9a89f9c Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Fri, 10 Jul 2026 00:59:27 +0800 Subject: feat(structural_data): align type use generation with group_impl --- mingling_macros/src/structural_data.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'mingling_macros/src/structural_data.rs') diff --git a/mingling_macros/src/structural_data.rs b/mingling_macros/src/structural_data.rs index d556d8c..5350d7e 100644 --- a/mingling_macros/src/structural_data.rs +++ b/mingling_macros/src/structural_data.rs @@ -268,11 +268,18 @@ pub(crate) fn group_structural(input: TokenStream) -> TokenStream { proc_macro2::Span::call_site(), ); - // Generate the appropriate `use` statement + // Generate the appropriate `use` statement for the original type + // (consistent with gen_type_use in group_impl.rs) let type_use = if type_path.path.segments.len() > 1 { quote! { #[allow(unused_imports)] use #type_path; } } else { - let ident = &type_name; + let ident = type_path + .path + .segments + .last() + .expect("TypePath must have at least one segment") + .ident + .clone(); quote! { #[allow(unused_imports)] use super::#ident; } }; -- cgit