diff options
| author | Seiichi Uchida <seuchida@gmail.com> | 2018-02-04 21:19:14 +0900 |
|---|---|---|
| committer | Seiichi Uchida <seuchida@gmail.com> | 2018-02-18 00:10:40 +0900 |
| commit | b5099a708d67ed165c5ebcfc2c55b1cdf2ad86bc (patch) | |
| tree | 1ac1b574e5327975ef033bddea12f6df54043f7e /src/libsyntax_pos | |
| parent | d6bdf296a42caec8711adc075782e0b8c920aa1f (diff) | |
| download | rust-b5099a708d67ed165c5ebcfc2c55b1cdf2ad86bc.tar.gz rust-b5099a708d67ed165c5ebcfc2c55b1cdf2ad86bc.zip | |
Replace dummy spans with empty spans
Diffstat (limited to 'src/libsyntax_pos')
| -rw-r--r-- | src/libsyntax_pos/lib.rs | 6 |
1 files changed, 6 insertions, 0 deletions
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 } |
