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.
This commit is contained in:
Nilstrieb 2022-07-29 16:34:06 +02:00 committed by nils
parent ee8c31e64d
commit 455a55e681

View File

@ -472,7 +472,7 @@ impl SourceMap {
let hi = self.lookup_char_pos(sp.hi());
let offset = self.lookup_char_pos(relative_to.lo());
if lo.file.name != offset.file.name {
if lo.file.name != offset.file.name || !relative_to.contains(sp) {
return self.span_to_embeddable_string(sp);
}