diff options
Diffstat (limited to 'src/libsyntax_pos')
| -rw-r--r-- | src/libsyntax_pos/lib.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index 4711d43bfab..9b83d5510fb 100644 --- a/src/libsyntax_pos/lib.rs +++ b/src/libsyntax_pos/lib.rs @@ -239,8 +239,15 @@ impl Span { /// Returns a new span representing an empty span at the beginning of this span #[inline] - pub fn empty(self) -> Span { - self.with_hi(self.lo()) + pub fn shrink_to_lo(self) -> Span { + let span = self.data(); + span.with_hi(span.lo) + } + /// Returns a new span representing an empty span at the end of this span + #[inline] + pub fn shrink_to_hi(self) -> Span { + let span = self.data(); + span.with_lo(span.hi) } /// Returns `self` if `self` is not the dummy span, and `other` otherwise. |
