-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-langRelevant to the language teamRelevant to the language team
Description
I'm trying to write a macro that sums a list of expressions, but it doesn't work because it's not possible to have + or * as the seperator token. For example:
macro_rules! sum {
(
$($e:expr)+ => (
$($e)++ // ???
)
}
It'll interpret is as there being no seperator token, and it seems to just stick a +
at the end. Escaping the first +
doesn't work either.
I'm using rust head
kettle11, rmja, Logarithmus, sh-at-cs and vE5li
Metadata
Metadata
Assignees
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-langRelevant to the language teamRelevant to the language team