about summary refs log tree commit diff
path: root/src/libsyntax/codemap.rs
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2017-12-22 15:55:44 -0800
committerEsteban Küber <esteban@kuber.com.ar>2017-12-25 09:47:22 -0800
commitfed4fcb3185eb5ba80bee1934b4108fb1af3eeca (patch)
treecec1118586c41b63bda9ec8b2fa46acee4d05a98 /src/libsyntax/codemap.rs
parent4a7c072fa61b42f96d8b75c37fc1edfd71172695 (diff)
downloadrust-fed4fcb3185eb5ba80bee1934b4108fb1af3eeca.tar.gz
rust-fed4fcb3185eb5ba80bee1934b4108fb1af3eeca.zip
"incompatible arm" diagnostic span tweak
Use span label instead of span note for single line spans in
"incompatible arm" diagnostic.
Diffstat (limited to 'src/libsyntax/codemap.rs')
-rw-r--r--src/libsyntax/codemap.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs
index e49a7117192..2f3e2b66113 100644
--- a/src/libsyntax/codemap.rs
+++ b/src/libsyntax/codemap.rs
@@ -446,6 +446,12 @@ impl CodeMap {
             .expect("CodeMap::span_to_unmapped_path called for imported FileMap?")
     }
 
+    pub fn is_multiline(&self, sp: Span) -> bool {
+        let lo = self.lookup_char_pos(sp.lo());
+        let hi = self.lookup_char_pos(sp.hi());
+        lo.line != hi.line
+    }
+
     pub fn span_to_lines(&self, sp: Span) -> FileLinesResult {
         debug!("span_to_lines(sp={:?})", sp);