diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-05-06 13:30:04 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-06 13:30:04 +0200 |
| commit | 8172ada984b4fa18967f08ce8651f8a8ae817400 (patch) | |
| tree | 14c4d790371c227098381df1f875737ae9a8a2fb /compiler/rustc_codegen_ssa/src/back | |
| parent | 77004eafeaf8f579fdcd9a746ee59274a83b8ad7 (diff) | |
| parent | bba2a1e07179c59b422e60411813446606b1b7f3 (diff) | |
| download | rust-8172ada984b4fa18967f08ce8651f8a8ae817400.tar.gz rust-8172ada984b4fa18967f08ce8651f8a8ae817400.zip | |
Rollup merge of #110985 - Amanieu:normalize_asm_spans, r=b-naber
Fix spans in LLVM-generated inline asm errors Previously, incorrect spans were reported if inline assembly contained CRLF (Windows) line endings. Fixes #110885
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/back')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/write.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index c42d59bd51c..c323372bda4 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -1821,9 +1821,15 @@ impl SharedEmitterMain { let source = sess .source_map() .new_source_file(FileName::inline_asm_source_code(&buffer), buffer); - let source_span = Span::with_root_ctxt(source.start_pos, source.end_pos); - let spans: Vec<_> = - spans.iter().map(|sp| source_span.from_inner(*sp)).collect(); + let spans: Vec<_> = spans + .iter() + .map(|sp| { + Span::with_root_ctxt( + source.normalized_byte_pos(sp.start as u32), + source.normalized_byte_pos(sp.end as u32), + ) + }) + .collect(); err.span_note(spans, "instantiated into assembly here"); } |
