Skip to content

Commit 42fc5ae

Browse files
committed
Fix span of AddrOf in format_args!() expansion.
Diagnostics should know that the `&` for arguments in format_args!() come from the macro expansion rather than from the original source.
1 parent 58a5ab5 commit 42fc5ae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/rustc_ast_lowering/src/format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ fn expand_format_args<'hir>(
489489
let placeholder_span =
490490
placeholder_span.unwrap_or(arg.expr.span).with_ctxt(macsp.ctxt());
491491
let arg = ctx.lower_expr(&arg.expr);
492-
let ref_arg = ctx.arena.alloc(ctx.expr_ref(arg.span, arg));
492+
let ref_arg = ctx.arena.alloc(ctx.expr_ref(arg.span.with_ctxt(macsp.ctxt()), arg));
493493
make_argument(ctx, placeholder_span, ref_arg, ty)
494494
},
495495
));

0 commit comments

Comments
 (0)