about summary refs log tree commit diff
path: root/src/libsyntax_pos
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-03-18 01:50:52 +0000
committerbors <bors@rust-lang.org>2018-03-18 01:50:52 +0000
commit5e3ecdce4e42ccc34c49f32f81be71ae00f2cf11 (patch)
tree5e306a69e1f08b96188fb8f19f0bfc79dde37caf /src/libsyntax_pos
parentca6a98426192f838cc90a18709f92d425b86029e (diff)
parenta02b1d7e2bd329bee0ad2f6a3e281c2004325540 (diff)
downloadrust-5e3ecdce4e42ccc34c49f32f81be71ae00f2cf11.tar.gz
rust-5e3ecdce4e42ccc34c49f32f81be71ae00f2cf11.zip
Auto merge of #48917 - petrochenkov:import, r=oli-obk
syntax: Make imports in AST closer to the source and cleanup their parsing

This is a continuation of https://github.com/rust-lang/rust/pull/45846 in some sense.
Diffstat (limited to 'src/libsyntax_pos')
-rw-r--r--src/libsyntax_pos/lib.rs11
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.