You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider the following macro and all the ways to invoke it:
macro_rules! make_item {($a:ident) => {struct $a;}}make_item!(A);// ok (semicolon required)make_item!{B}// ok (semicolon not required)fnc(){make_item!(C);}// okfnd(){make_item!(D)}// bad (expected: missing semicolon)fne(){make_item!{E}}// bad (BUG: semicolon should not be required)fnf(){make_item!{F};}// ok (workaround)fngh(){make_item!{G}make_item!(H);}// ok (further evidence case E is a bug)
I believe that case E should be accepted, however it gives the error that the macro is invalid in expression position. My theory (before investigating) is that the tail of the function is considered as expression position because the macro expander forgets the possibility that a macro may generate items.