These are chat archives for rust-lang/rust

Jun 2017
Gwen Lofman
Jun 17 2017 21:15

I'm trying to write a macro that lets me define an enum like so:

enum_range!( Pattern {C(1; 106)} );

Which results in

enum Pattern {
// ....

The part I'm stuck on is generating a sequence of identifiers from C1 to C106, if that's possible at all. Is there any way to generate a range of numbers in a macro, and then concatenate them to the end of C? Should I use a token tree? Expression? Identifiers?

Denis Lisov
Jun 17 2017 21:48
Likely to be impossible without hacks based on macros 1.1