From b5099a708d67ed165c5ebcfc2c55b1cdf2ad86bc Mon Sep 17 00:00:00 2001 From: Seiichi Uchida Date: Sun, 4 Feb 2018 21:19:14 +0900 Subject: Replace dummy spans with empty spans --- src/libsyntax_pos/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/libsyntax_pos') diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index 294506625bc..f9e01b630ae 100644 --- a/src/libsyntax_pos/lib.rs +++ b/src/libsyntax_pos/lib.rs @@ -216,6 +216,12 @@ impl Span { self.data().with_ctxt(ctxt) } + /// Returns a new span representing an empty span at the beginning of this span + #[inline] + pub fn empty(self) -> Span { + span.with_hi(self.lo()) + } + /// Returns `self` if `self` is not the dummy span, and `other` otherwise. pub fn substitute_dummy(self, other: Span) -> Span { if self.source_equal(&DUMMY_SP) { other } else { self } -- cgit 1.4.1-3-g733a5