You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 9, 2023. It is now read-only.
Originally filed as dtolnay/quote#82 but I would like this to begin its life as a separate library.
The current macro_rules-based quote macro has the limitation that duplicate interpolations inside of a repetition are not allowed. quote! { #a #a } works but quote! { #(#a #a)* } does not work. The reason boils down to macro_rules macros having no way to determine that two identifiers are equal.
That last expansion is illegal so the quote invocation fails.
error[E0416]: identifier `a` is bound more than once in the same pattern --> src/main.rs:12:17 |12 | for (a, a) in a.into_iter().zip(a) { | ^ used in a pattern more than once
In an implementation as a procedural macro we would want that invocation to expand instead as:
{letmut _s = TokenStream::new();let _span = Span::call_site();for a in a {ToTokens::to_tokens(&a,&mut _s);ToTokens::to_tokens(&a,&mut _s);}
_s
}