diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2023-09-03 10:15:35 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2023-09-03 12:56:10 +0000 |
| commit | 61a0b77e17531e6d65d8fad80588237ee5e14529 (patch) | |
| tree | c64771ed523f50f4fc449a88d91a54a98cc0320d | |
| parent | 65d75fdc38ba04ae9161fb75050cd6fdaab078d3 (diff) | |
| download | rust-61a0b77e17531e6d65d8fad80588237ee5e14529.tar.gz rust-61a0b77e17531e6d65d8fad80588237ee5e14529.zip | |
Use relative positions inside a SourceFile.
| -rw-r--r-- | src/debuginfo/line_info.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/debuginfo/line_info.rs b/src/debuginfo/line_info.rs index 50bc7a127af..998263de584 100644 --- a/src/debuginfo/line_info.rs +++ b/src/debuginfo/line_info.rs @@ -82,12 +82,9 @@ impl DebugContext { match tcx.sess.source_map().lookup_line(span.lo()) { Ok(SourceFileAndLine { sf: file, line }) => { let line_pos = file.lines(|lines| lines[line]); + let col = file.relative_position(span.lo()) - line_pos; - ( - file, - u64::try_from(line).unwrap() + 1, - u64::from((span.lo() - line_pos).to_u32()) + 1, - ) + (file, u64::try_from(line).unwrap() + 1, u64::from(col.to_u32()) + 1) } Err(file) => (file, 0, 0), } |
