Add support for repetition to proc_macro::quote
#140238
Labels
A-macros
Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
A-proc-macros
Area: Procedural macros
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
E-help-wanted
Call for participation: Help is requested to fix this issue.
E-medium
Call for participation: Medium difficulty. Experience needed to fix: Intermediate.
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
WG-macros
Working group: Macros
I'm opening a standalone issue to have something with "help wanted" labels in case anyone is interested in picking this up.
Our
proc_macro::quote
does not support repetition, unlikequote
from thequote
crate. As mentioned many times on the tracking issue, this is something we should support or at least account for beforeproc_macro::quote
can be stabilized.This should use the syntax:
Where
CONTENTS
is the thing to be repeated andSEP
is an optional single-character separator. Expansion should work for anything that implementsIntoIterator
. This matches the quote crate's logic (except quote::quote uses#
rather than$
).It's probably easiest to just copy
quote
's logic here, which uses an extension trait to facilitate this.quote
crate source repo: https://github.com/dtolnay/quote.quote
that needs to be updated: https://github.com/rust-lang/rust/blob/fa58ce343ad498196d799a7381869e79938e952a/library/proc_macro/src/quote.rstests/ui/proc-macro/quote
for things we should reject)quote!
macro inproc_macro
#54722The text was updated successfully, but these errors were encountered: