1
Fork 0

Auto merge of #76485 - estebank:format_arg_capture_spans, r=davidtwco

Point at named argument not found when using `format_args_capture` instead of whole format string
This commit is contained in:
bors 2020-09-26 10:05:49 +00:00
commit 6f9a8a7f9b
3 changed files with 22 additions and 24 deletions

View file

@ -543,9 +543,12 @@ impl<'a, 'b> Context<'a, 'b> {
let idx = self.args.len();
self.arg_types.push(Vec::new());
self.arg_unique_types.push(Vec::new());
self.args.push(
self.ecx.expr_ident(self.fmtsp, Ident::new(name, self.fmtsp)),
);
let span = if self.is_literal {
*self.arg_spans.get(self.curpiece).unwrap_or(&self.fmtsp)
} else {
self.fmtsp
};
self.args.push(self.ecx.expr_ident(span, Ident::new(name, span)));
self.names.insert(name, idx);
self.verify_arg_type(Exact(idx), ty)
} else {