Correctly mark the span of captured arguments in format_args!()

It should only include the identifier, or misspelling suggestions will be wrong.
This commit is contained in:
Chayim Refael Friedman 2022-02-16 00:38:04 +00:00 committed by GitHub
parent 1e12aef3fa
commit 91adb6ccd6
15 changed files with 105 additions and 74 deletions

View file

@ -700,11 +700,11 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, args: AsmArgs) -> Option<ast::Inl
Some(idx)
}
}
parse::ArgumentNamed(name) => match args.named_args.get(&name) {
parse::ArgumentNamed(name, span) => match args.named_args.get(&name) {
Some(&idx) => Some(idx),
None => {
let msg = format!("there is no argument named `{}`", name);
ecx.struct_span_err(span, &msg).emit();
ecx.struct_span_err(template_span.from_inner(span), &msg).emit();
None
}
},