Closed
Description
This code
macro_rules! foo {
() => {
assert_eq!("A", "A");
assert_eq!("B", "B");
}
}
fn main() {
foo!()
}
gives the error:
foo.rs:4:9: 4:18 error: macro expansion ignores token `assert_eq` and any following
foo.rs:4 assert_eq!("B", "B");
^~~~~~~~~
foo.rs:9:5: 9:11 note: caused by the macro expansion here; the usage of `foo` is likely invalid in this context
foo.rs:9 foo!()
^~~~~~
error: aborting due to previous error
The problem is actually a missing semicolon after foo!()
, but the message wasn't really helpful in figuring that out. (I initially left out the semicolon out of habit from C, where including it would result in an extra empty statement after expansion.)