added byte position range for proc_macro::Span
This commit is contained in:
parent
35a0961bbc
commit
b8c6d2211e
3 changed files with 19 additions and 2 deletions
|
@ -18,7 +18,7 @@ use rustc_span::def_id::CrateNum;
|
|||
use rustc_span::symbol::{self, sym, Symbol};
|
||||
use rustc_span::{BytePos, FileName, Pos, SourceFile, Span};
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
use std::ops::Bound;
|
||||
use std::ops::{Bound, Range};
|
||||
|
||||
trait FromInternal<T> {
|
||||
fn from_internal(x: T) -> Self;
|
||||
|
@ -634,6 +634,10 @@ impl server::Span for Rustc<'_, '_> {
|
|||
span.source_callsite()
|
||||
}
|
||||
|
||||
fn position(&mut self, span: Self::Span) -> Range<u32> {
|
||||
Range { start: span.lo().0, end: span.lo().0 }
|
||||
}
|
||||
|
||||
fn start(&mut self, span: Self::Span) -> LineColumn {
|
||||
let loc = self.sess().source_map().lookup_char_pos(span.lo());
|
||||
LineColumn { line: loc.line, column: loc.col.to_usize() }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue