Closed
Description
macro_rules! foo {
(item) => { fn not_a_pattern() {} };
(pattern) => { ref _x }
}
fn main() {
foo!(pattern);
let foo!(item) = ();
}
<anon>:3:20: 3:23 error: expected identifier, found keyword `ref`
<anon>:3 (pattern) => { ref _x }
^~~
<anon>:3:24: 3:26 error: macro expansion ignores token `_x` and any following
<anon>:3 (pattern) => { ref _x }
^~
<anon>:2:17: 2:19 error: expected identifier, found keyword `fn`
<anon>:2 (item) => { fn not_a_pattern() {} };
^~
<anon>:2:20: 2:33 error: macro expansion ignores token `not_a_pattern` and any following
<anon>:2 (item) => { fn not_a_pattern() {} };
^~~~~~~~~~~~~
error: aborting due to 4 previous errors
The error messages should point to the respective foo!
invocations, not just the contents of the macro, like
<anon>:3:20: 3:23 error: expected identifier, found keyword `ref`
<anon>:3 (pattern) => { ref _x }
^~~
<anon>:1:1: 4:2 note: in expansion of foo!
<anon>:6:5: 6:19 note: expansion site