diff options
| author | bors <bors@rust-lang.org> | 2019-01-22 10:59:09 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-01-22 10:59:09 +0000 |
| commit | 76c87a166fa8ca247855ea6c32465d627d1ead14 (patch) | |
| tree | cbbcf9fa8edab3408c29fa3d816c7e397cca9269 /src/libsyntax_pos/lib.rs | |
| parent | 70015373b4980fbfa10130de4b0ce041f5b5da8b (diff) | |
| parent | f077990ed4e7fadd0197d00d65a198e02544ab07 (diff) | |
| download | rust-76c87a166fa8ca247855ea6c32465d627d1ead14.tar.gz rust-76c87a166fa8ca247855ea6c32465d627d1ead14.zip | |
Auto merge of #56221 - estebank:remove-dummy-checks, r=varkor
Remove unnecessary dummy span checks The emitter already verifies wether a given span note or span label can be emitted to the output. If it can't, because it is a dummy span, it will be either elided for labels or emitted as an unspanned note/help when applicable.
Diffstat (limited to 'src/libsyntax_pos/lib.rs')
| -rw-r--r-- | src/libsyntax_pos/lib.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index 6a41a93f0b4..d9d7f9b0cb4 100644 --- a/src/libsyntax_pos/lib.rs +++ b/src/libsyntax_pos/lib.rs @@ -668,6 +668,11 @@ impl MultiSpan { &self.primary_spans } + /// Returns whether any of the primary spans is displayable. + pub fn has_primary_spans(&self) -> bool { + self.primary_spans.iter().any(|sp| !sp.is_dummy()) + } + /// Returns `true` if this contains only a dummy primary span with any hygienic context. pub fn is_dummy(&self) -> bool { let mut is_dummy = true; @@ -726,6 +731,11 @@ impl MultiSpan { span_labels } + + /// Returns whether any of the span labels is displayable. + pub fn has_span_labels(&self) -> bool { + self.span_labels.iter().any(|(sp, _)| !sp.is_dummy()) + } } impl From<Span> for MultiSpan { |
