diff options
| author | bors <bors@rust-lang.org> | 2017-12-26 15:15:08 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-12-26 15:15:08 +0000 |
| commit | 269827ced91bb2b702d4cb62e3e164b225f73157 (patch) | |
| tree | 4af2c01dd6028f5a6fba0d9401ba3ce1df41755c /src/libsyntax | |
| parent | 0efdfa1d6220484770e3730062b92a9d2b2e20b9 (diff) | |
| parent | fed4fcb3185eb5ba80bee1934b4108fb1af3eeca (diff) | |
| download | rust-269827ced91bb2b702d4cb62e3e164b225f73157.tar.gz rust-269827ced91bb2b702d4cb62e3e164b225f73157.zip | |
Auto merge of #46956 - estebank:incompatible-arm-span-label, r=Zoxc
"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')
| -rw-r--r-- | src/libsyntax/codemap.rs | 6 |
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); |
