1
Fork 0

Fix spans for asm diagnostics

Line spans were incorrect if the first line of an asm statement was an
empty string.
This commit is contained in:
Amanieu d'Antras 2022-07-12 22:54:47 +02:00
parent 50b00252ae
commit f4e7813121
5 changed files with 42 additions and 4 deletions

View file

@ -534,8 +534,8 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, args: AsmArgs) -> Option<ast::Inl
let mut template_strs = Vec::with_capacity(args.templates.len());
for template_expr in args.templates.into_iter() {
if !template.is_empty() {
for (i, template_expr) in args.templates.into_iter().enumerate() {
if i != 0 {
template.push(ast::InlineAsmTemplatePiece::String("\n".to_string()));
}