Closed
Description
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)
fn c() { make_item!(C); } // ok
fn d() { make_item!(D) } // bad (expected: missing semicolon)
fn e() { make_item! { E } } // bad (BUG: semicolon should not be required)
fn f() { make_item! { F }; } // ok (workaround)
fn gh() { 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.
Metadata
Metadata
Assignees
Labels
No labels