From b5845c64275593a37a9c74dd8e9c74ee3df72b28 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Fri, 29 Jan 2016 11:25:20 +0100 Subject: [PATCH 1/3] fix overflow due to multiline error span --- src/libsyntax/errors/emitter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsyntax/errors/emitter.rs b/src/libsyntax/errors/emitter.rs index c1239bfd66d..4b6f42db50d 100644 --- a/src/libsyntax/errors/emitter.rs +++ b/src/libsyntax/errors/emitter.rs @@ -518,7 +518,7 @@ impl EmitterWriter { }; let lo = self.cm.lookup_char_pos(sp.lo); let hi = self.cm.lookup_char_pos(sp.hi); - let elide_sp = (lo.line - hi.line) > MAX_SP_LINES; + let elide_sp = (hi.line - lo.line) > MAX_SP_LINES; let line_num = line.line_index + 1; if !(lo.line <= line_num && hi.line >= line_num) { From fe10914adc783472ae0847d5163385d0e49046a4 Mon Sep 17 00:00:00 2001 From: mitaa Date: Fri, 29 Jan 2016 13:45:15 +0100 Subject: [PATCH 2/3] Update emitter.rs --- src/libsyntax/errors/emitter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsyntax/errors/emitter.rs b/src/libsyntax/errors/emitter.rs index 4b6f42db50d..f6a01d24995 100644 --- a/src/libsyntax/errors/emitter.rs +++ b/src/libsyntax/errors/emitter.rs @@ -1026,7 +1026,7 @@ mod test { \x20 ^ ^\n"; let expect0_end = "dummy.txt: 5 ccccc\n\ - \x20 ...\n\ + dummy.txt: 6 xxxxx\n\ dummy.txt: 7 yyyyy\n\ \x20 ^\n\ \x20 ...\n\ From 54927ac57f95b4ac6747d29af45fef8e47225852 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Sat, 30 Jan 2016 13:40:40 +0100 Subject: [PATCH 3/3] off by one --- src/libsyntax/errors/emitter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsyntax/errors/emitter.rs b/src/libsyntax/errors/emitter.rs index f6a01d24995..d3982f6a5b6 100644 --- a/src/libsyntax/errors/emitter.rs +++ b/src/libsyntax/errors/emitter.rs @@ -518,7 +518,7 @@ impl EmitterWriter { }; let lo = self.cm.lookup_char_pos(sp.lo); let hi = self.cm.lookup_char_pos(sp.hi); - let elide_sp = (hi.line - lo.line) > MAX_SP_LINES; + let elide_sp = (hi.line - lo.line) >= MAX_SP_LINES; let line_num = line.line_index + 1; if !(lo.line <= line_num && hi.line >= line_num) {