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
This commit is contained in:
commit
8172ada984
2 changed files with 31 additions and 3 deletions
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue