Rollup merge of #99192 - Amanieu:fix-asm-srcloc, r=petrochenkov

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:
Dylan DPC 2022-07-14 19:24:05 +05:30 committed by GitHub
commit d3a1aa0b43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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()));
}