I'm trying to write a macro which emits an enum definition. As part of this, I'd like to do something like:
enum Foo {
$(
__inner_normalize!($variant),
)*
}
Unfortunately, it looks like you can't use a macro invocation where a path
AST node is expected. As a demonstration, the following code gives the following error:
macro_rules! foo {
($p:path) => {}
}
macro_rules! bar {
() => {}
}
foo!(bar!());
Error:
error: no rules expected the token `!`
--> src/lib.rs:9:9
|
1 | macro_rules! foo {
| ---------------- when calling this macro
...
9 | foo!(bar!());
| ^ no rules expected this token in macro call
Is there any way around this limitation - to use a macro invocation in path
position?