Open
Description
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=a17456ca7139db13e945cbde87ae6fbd
macro_rules! m {
() => {
$x;
}
}
fn foo() {
m!()
}
The current output is:
error: expected expression, found `$`
--> src/lib.rs:3:9
|
3 | $x;
| ^^ expected expression
...
8 | m!()
| ---- in this macro invocation
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
Ideally the output should look like:
error[E0425]: cannot find macro parameter `$x` in this scope
--> src/lib.rs:8:5
|
2 | () => {
| ^^ in this macro matcher
3 | $x;
| ^^ not found in this scope
...
8 | m!()
| ---- in this macro invocation
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
@rustbot label +A-macros
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Call for participation: Medium difficulty. Experience needed to fix: Intermediate.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Relevant to the compiler team, which will review and decide on the PR/issue.