Closed
Description
This kind of macro pattern seems to mess up the span:
macro_rules! bad {
($s:ident whatever) => {
{
let $s = 0;
*&mut $s = 0;
}
}
}
fn main() {
bad!(foo whatever);
}
Compiling it results in a messed up error message:
<anon>:11:14: 11:22 error: cannot borrow immutable local variable `foo` as mutable
<anon>:11 bad!(foo whatever);
^~~~~~~~
<anon>:11:5: 11:24 note: in this expansion of bad! (defined in <anon>)
<anon>:11:14: 11:22 help: to make the local variable mutable, use `mut` as shown:
<anon>: bad!(foo mut whatever);
<anon>:11:5: 11:24 note: in this expansion of bad! (defined in <anon>)
error: aborting due to previous error