diff options
| -rw-r--r-- | mingling_macros/src/structural_data.rs | 11 |
1 files changed, 9 insertions, 2 deletions
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; } }; |
