diff options
| author | Amanieu d'Antras <amanieu@gmail.com> | 2022-07-12 22:54:47 +0200 |
|---|---|---|
| committer | Amanieu d'Antras <amanieu@gmail.com> | 2022-07-14 11:20:52 +0200 |
| commit | f4e78131218efac2c17b9a150ebd3ac7868d0dbe (patch) | |
| tree | 77790749ed3a0f0fd43de326d4189a774e57adc3 /compiler/rustc_builtin_macros | |
| parent | 50b00252aeb77b10db04d65dc9e12ce758def4b5 (diff) | |
| download | rust-f4e78131218efac2c17b9a150ebd3ac7868d0dbe.tar.gz rust-f4e78131218efac2c17b9a150ebd3ac7868d0dbe.zip | |
Fix spans for asm diagnostics
Line spans were incorrect if the first line of an asm statement was an empty string.
Diffstat (limited to 'compiler/rustc_builtin_macros')
| -rw-r--r-- | compiler/rustc_builtin_macros/src/asm.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_builtin_macros/src/asm.rs b/compiler/rustc_builtin_macros/src/asm.rs index c95d7147176..47fd62d084e 100644 --- a/compiler/rustc_builtin_macros/src/asm.rs +++ b/compiler/rustc_builtin_macros/src/asm.rs @@ -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())); } |
