Fix a format_args span to be expansion

This commit is contained in:
Cameron Steffen 2021-10-21 09:01:16 -05:00
parent 37f70a0e1e
commit 4cfb7add77
26 changed files with 51 additions and 1 deletions

View file

@ -793,7 +793,10 @@ impl<'a, 'b> Context<'a, 'b> {
for arg_ty in self.arg_unique_types[i].iter() {
locals.push(Context::format_arg(self.ecx, self.macsp, e.span, arg_ty, name));
}
heads.push(self.ecx.expr_addr_of(e.span, e));
// use the arg span for `&arg` so that borrowck errors
// point to the specific expression passed to the macro
// (the span is otherwise unavailable in MIR)
heads.push(self.ecx.expr_addr_of(e.span.with_ctxt(self.macsp.ctxt()), e));
}
for pos in self.count_args {
let index = match pos {