File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,22 @@ pub fn byte_range(this: &Span) -> Range<usize> {
1313 this. byte_range ( )
1414}
1515
16+ pub fn start ( this : & Span ) -> Span {
17+ this. start ( )
18+ }
19+
20+ pub fn end ( this : & Span ) -> Span {
21+ this. end ( )
22+ }
23+
24+ pub fn line ( this : & Span ) -> usize {
25+ this. line ( )
26+ }
27+
28+ pub fn column ( this : & Span ) -> usize {
29+ this. column ( )
30+ }
31+
1632pub fn join ( this : & Span , other : Span ) -> Option < Span > {
1733 this. join ( other)
1834}
Original file line number Diff line number Diff line change @@ -477,6 +477,12 @@ impl Span {
477477 #[ cfg( span_locations) ]
478478 pub fn start ( & self ) -> LineColumn {
479479 match self {
480+ #[ cfg( proc_macro_span) ]
481+ Span :: Compiler ( s) => LineColumn {
482+ line : s. line ( ) ,
483+ column : s. column ( ) ,
484+ } ,
485+ #[ cfg( not( proc_macro_span) ) ]
480486 Span :: Compiler ( _) => LineColumn { line : 0 , column : 0 } ,
481487 Span :: Fallback ( s) => s. start ( ) ,
482488 }
@@ -485,6 +491,15 @@ impl Span {
485491 #[ cfg( span_locations) ]
486492 pub fn end ( & self ) -> LineColumn {
487493 match self {
494+ #[ cfg( proc_macro_span) ]
495+ Span :: Compiler ( s) => {
496+ let end = s. end ( ) ;
497+ LineColumn {
498+ line : end. line ( ) ,
499+ column : end. column ( ) ,
500+ }
501+ }
502+ #[ cfg( not( proc_macro_span) ) ]
488503 Span :: Compiler ( _) => LineColumn { line : 0 , column : 0 } ,
489504 Span :: Fallback ( s) => s. end ( ) ,
490505 }
You can’t perform that action at this time.
0 commit comments