Closed
Description
I’ll admit, the whole error message is not too bad if you ignore the first line.
If only it wouldn’t suggest that 1 + 1
is not an expression...
macro_rules! test {
(let $p:pat = $e:expr) => {test!(($p,$e))};
// actual mistake: this should be expr
// vvv
(($p:pat, $e:pat)) => {let $p = $e;};
}
fn foo() {
test!(let x = 1+1);
}
Errors:
Compiling playground v0.0.1 (/playground)
error: expected expression, found `1 + 1`
--> src/lib.rs:6:37
|
6 | (($p:pat, $e:pat)) => {let $p = $e;};
| ^^ expected expression
...
10 | test!(let x = 1+1);
| ------------------- in this macro invocation
error: aborting due to previous error
error: could not compile `playground`.
To learn more, run the command again with --verbose.
@rustbot modify labels to T-compiler, A-macros, C-enhancement, D-papercut, A-diagnostics
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Category: An issue proposing an enhancement or a PR with one.Diagnostics: An error or lint that needs small tweaks.Relevant to the compiler team, which will review and decide on the PR/issue.