From 5fe400c006d9d143aa7b977cb13f95e7380754a5 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Sat, 16 May 2026 21:55:55 +0800 Subject: Validate single-segment types in attribute macros --- mingling_macros/src/renderer.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'mingling_macros/src/renderer.rs') diff --git a/mingling_macros/src/renderer.rs b/mingling_macros/src/renderer.rs index 362a4a4..565ffa3 100644 --- a/mingling_macros/src/renderer.rs +++ b/mingling_macros/src/renderer.rs @@ -76,6 +76,11 @@ pub fn renderer_attr(item: TokenStream) -> TokenStream { Err(e) => return e.to_compile_error().into(), }; + // Check that the previous type is a single-segment type (no `::`) + if let Some(err_tokens) = crate::check_single_segment_type(&previous_type, "#[renderer]") { + return err_tokens.into(); + } + // Validate return type if let Err(e) = extract_return_type(&input_fn.sig) { return e.to_compile_error().into(); -- cgit