-
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 lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.Category: This is a bug.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
I don't know what to make of this error.
use std::fmt::Debug;
macro_rules! check {
($ty:ty, $expected:expr) => {
};
($ty_of:expr, $expected:expr) => {
};
}
fn main() {
check!(
<str as Debug>::fmt,
"foo",
);
}
Errors:
Compiling playground v0.0.1 (/playground)
error: expected identifier, found `,`
--> src/main.rs:14:16
|
14 | <str as Debug>::fmt,
| ^
| |
| expected identifier
| help: remove this comma
error: aborting due to previous error
error: Could not compile `playground`.
To learn more, run the command again with --verbose.
On stable (1.34) the output is
error: expected identifier, found `,`
--> src/main.rs:14:25
|
14 | <str as Debug>::fmt,
| ^
| |
| expected identifier
| help: remove this comma
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-bugCategory: This is a bug.Category: This is a bug.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.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
estebank commentedon Apr 24, 2019
I'm pretty sure this is fallout from the "missing comma here" suggestion for macros, that evaluates the macro again with the current arguments but adding a comma token in between the argument tokens in different combinations to see if it would be correct. My guess is that that is causing a parse error that doesn't happen for normal things than only have one token in them. We can disable the suggestion when fully qualified paths are involved.
Auto merge of #60248 - estebank:macro-comma, r=oli-obk