Skip to content

Commit 455a55e

Browse files
committed
Show absolute line numbers if span is outside relative span
In the MIR pretty printing, it can sometimes happen that the span of the statement is outside the span of the body (for example through inlining). In this case, don't display a relative span but an absolute span. This will make the mir-opt-tests a little more prone to diffs again, but the impact should be small.
1 parent ee8c31e commit 455a55e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/rustc_span/src/source_map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ impl SourceMap {
472472
let hi = self.lookup_char_pos(sp.hi());
473473
let offset = self.lookup_char_pos(relative_to.lo());
474474

475-
if lo.file.name != offset.file.name {
475+
if lo.file.name != offset.file.name || !relative_to.contains(sp) {
476476
return self.span_to_embeddable_string(sp);
477477
}
478478

0 commit comments

Comments
 (0)