Open
Description
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, unlike quote
from the quote
crate. As mentioned many times on the tracking issue, this is something we should support or at least account for before proc_macro::quote
can be stabilized.
This should use the syntax:
proc_macro::quote! {
$( CONTENTS )SEP*
}
Where CONTENTS
is the thing to be repeated and SEP
is an optional single-character separator. Expansion should work for anything that implements IntoIterator
. 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.- Link to source for our
quote
that needs to be updated: https://github.com/rust-lang/rust/blob/fa58ce343ad498196d799a7381869e79938e952a/library/proc_macro/src/quote.rs - Link to tests that should be updated: https://github.com/rust-lang/rust/blob/c02a4f0852e6665cf3df3867982021383f5615df/tests/ui/proc-macro/quote/auxiliary/basic.rs (plus any new tests in
tests/ui/proc-macro/quote
for things we should reject) - Tracking issue: Tracking issue for the
quote!
macro inproc_macro
#54722
Metadata
Metadata
Assignees
Labels
Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: Procedural macrosCategory: A feature request, i.e: not implemented / a PR.Call for participation: Help is requested to fix this issue.Call for participation: Medium difficulty. Experience needed to fix: Intermediate.Relevant to the library team, which will review and decide on the PR/issue.Working group: Macros