Skip to content

Commit 61a0b77

Browse files
committed
Use relative positions inside a SourceFile.
1 parent 65d75fd commit 61a0b77

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/debuginfo/line_info.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,9 @@ impl DebugContext {
8282
match tcx.sess.source_map().lookup_line(span.lo()) {
8383
Ok(SourceFileAndLine { sf: file, line }) => {
8484
let line_pos = file.lines(|lines| lines[line]);
85+
let col = file.relative_position(span.lo()) - line_pos;
8586

86-
(
87-
file,
88-
u64::try_from(line).unwrap() + 1,
89-
u64::from((span.lo() - line_pos).to_u32()) + 1,
90-
)
87+
(file, u64::try_from(line).unwrap() + 1, u64::from(col.to_u32()) + 1)
9188
}
9289
Err(file) => (file, 0, 0),
9390
}

0 commit comments

Comments
 (0)