File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,8 @@ macro_rules! with_api {
9797 fn byte_range( $self: $S:: Span ) -> Range <usize >;
9898 fn start( $self: $S:: Span ) -> $S:: Span ;
9999 fn end( $self: $S:: Span ) -> $S:: Span ;
100+ fn line( $self: $S:: Span ) -> usize ;
101+ fn column( $self: $S:: Span ) -> usize ;
100102 fn join( $self: $S:: Span , other: $S:: Span ) -> Option <$S:: Span >;
101103 fn subspan( $self: $S:: Span , start: Bound <usize >, end: Bound <usize >) -> Option <$S:: Span >;
102104 fn resolved_at( $self: $S:: Span , at: $S:: Span ) -> $S:: Span ;
Original file line number Diff line number Diff line change @@ -505,6 +505,22 @@ impl Span {
505505 Span ( self . 0 . end ( ) )
506506 }
507507
508+ /// The one-indexed line of the source file where the span starts.
509+ ///
510+ /// To obtain the line of the span's end, use `span.end().line()`.
511+ #[ unstable( feature = "proc_macro_span" , issue = "54725" ) ]
512+ pub fn line ( & self ) -> usize {
513+ self . 0 . line ( )
514+ }
515+
516+ /// The one-indexed column of the source file where the span starts.
517+ ///
518+ /// To obtain the column of the span's end, use `span.end().column()`.
519+ #[ unstable( feature = "proc_macro_span" , issue = "54725" ) ]
520+ pub fn column ( & self ) -> usize {
521+ self . 0 . column ( )
522+ }
523+
508524 /// Creates a new span encompassing `self` and `other`.
509525 ///
510526 /// Returns `None` if `self` and `other` are from different files.
You can’t perform that action at this time.
0 commit comments