concat_idents! inside macro


#1

I want use concat_idents! in this way

static concat_idents!($name, MAP): // Type = ....

but I can’t, and issue about concat_idents!() is tracked at rust-lang/rust#29599.
And also concat_idents!!($name, MAP) from comment does not work.

How can I bypass this issue?


#2

You can’t.

It’s made-up speculative syntax.

You don’t.

…not unless you want to write a compiler plugin and limit yourself to nightly compilers and tracking changes in libsyntax forevermore.

If you want identifiers, they have to be passed into the macro when you invoke it.


#3

Thanks. I will use it, as my purpose is too simple to create a plugin.