-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
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.)
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.