-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Closed
Closed
Copy link
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-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
#![feature(macro_rules)]
macro_rules! x {
() => {{
struct Foo;
}}
}
x!()<anon>:4:12: 4:13 error: macro expansion ignores token `{` and any following
<anon>:4 () => {{
^
i.e. the parser is seeing the { and bailing on parsing an item, and the macro expander is diligently reporting that those tokens were ignored. It would be better if we could emit a more helpful message for this case specifically, since expression macros require the {s to be able to contain multiple things so users used to this can get tripped up (item macros don't need scopes for multiple items, and doing this would restrict those items to that inner scope anyway).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-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.