From fed4fcb3185eb5ba80bee1934b4108fb1af3eeca Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Fri, 22 Dec 2017 15:55:44 -0800 Subject: "incompatible arm" diagnostic span tweak Use span label instead of span note for single line spans in "incompatible arm" diagnostic. --- src/libsyntax/codemap.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/libsyntax') 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); -- cgit 1.4.1-3-g733a5