Skip to content

Commit a0f38f3

Browse files
committed
proc_macro_server: fix 0-based to 1-based num convertion
1 parent 6169a1a commit a0f38f3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/rustc_expand/src/proc_macro_server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,13 +633,13 @@ impl server::Span for Rustc<'_, '_> {
633633
fn start(&mut self, span: Self::Span) -> LineColumn {
634634
let loc = self.sess().source_map().lookup_char_pos(span.lo());
635635
//FIXME: LineColumn.column is 1-based, but loc.col is 0-based
636-
LineColumn { line: loc.line.to_usize(), column: loc.col.to_usize() }
636+
LineColumn { line: loc.line.to_usize(), column: loc.col.to_usize() + 1 }
637637
}
638638

639639
fn end(&mut self, span: Self::Span) -> LineColumn {
640640
let loc = self.sess().source_map().lookup_char_pos(span.hi());
641641
//FIXME: and here
642-
LineColumn { line: loc.line.to_usize(), column: loc.col.to_usize() }
642+
LineColumn { line: loc.line.to_usize(), column: loc.col.to_usize() + 1 }
643643
}
644644

645645
fn before(&mut self, span: Self::Span) -> Self::Span {

0 commit comments

Comments
 (0)