about summary refs log tree commit diff
path: root/src/libsyntax/errors
diff options
context:
space:
mode:
authormitaa <mitaa.ceb@gmail.com>2016-02-03 16:07:40 +0100
committermitaa <mitaa.ceb@gmail.com>2016-02-03 16:54:37 +0100
commit1fcdedb8fb1725c8f1dafa6badb890ca8181699f (patch)
tree182ce7a5c449ad081ad0f6929ff964d8b70314f8 /src/libsyntax/errors
parentdb6f888e7830b0b91a03b2cf141ba0511adaca5b (diff)
downloadrust-1fcdedb8fb1725c8f1dafa6badb890ca8181699f.tar.gz
rust-1fcdedb8fb1725c8f1dafa6badb890ca8181699f.zip
Fix rendering of single-char-span
A span spanning only a single character would render like `^~`
instead of just `^`.
Diffstat (limited to 'src/libsyntax/errors')
-rw-r--r--src/libsyntax/errors/emitter.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/libsyntax/errors/emitter.rs b/src/libsyntax/errors/emitter.rs
index 94bbd1bd128..4272f281edb 100644
--- a/src/libsyntax/errors/emitter.rs
+++ b/src/libsyntax/errors/emitter.rs
@@ -410,7 +410,7 @@ impl EmitterWriter {
                         chars.next();
                     }
                 }
-                if (col - col_ptr) > 1 {
+                if (col - col_ptr) > 0 {
                     // One extra squiggly is replaced by a "^"
                     s.pop();
                 }
@@ -962,7 +962,7 @@ mod test {
                    _____\n\
                    ddd__eee_\n\
                    elided\n\
-                   _ff_gg";
+                   __f_gg";
         let file = cm.new_filemap_and_lines("dummy.txt", inp);
 
         let span = |lo, hi, (off_lo, off_hi)| {
@@ -976,7 +976,7 @@ mod test {
         let sp1 = span(0, 6, (0, 5));
         let sp2 = span(8, 8, (0, 3));
         let sp3 = span(8, 8, (5, 8));
-        let sp4 = span(10, 10, (1, 3));
+        let sp4 = span(10, 10, (2, 3));
         let sp5 = span(10, 10, (4, 6));
 
         let expect0 = "dummy.txt: 5 ccccc\n\
@@ -986,8 +986,8 @@ mod test {
                        dummy.txt: 9 ddd__eee_\n\
                     \x20            ^~~  ^~~\n\
                     \x20            ...\n\
-                       dummy.txt:11 _ff_gg\n\
-                    \x20             ^~ ^~\n";
+                       dummy.txt:11 __f_gg\n\
+                    \x20              ^ ^~\n";
 
         let expect = "dummy.txt: 1 aaaaa\n\
                       dummy.txt: 2 aaaaa\n\
@@ -1008,8 +1008,8 @@ mod test {
         let expect2 = "dummy.txt: 9 ddd__eee_\n\
                     \x20            ^~~  ^~~\n\
                     \x20            ...\n\
-                       dummy.txt:11 _ff_gg\n\
-                    \x20             ^~ ^~\n";
+                       dummy.txt:11 __f_gg\n\
+                    \x20              ^ ^~\n";
 
 
         let expect_end = "dummy.txt: 1 aaaaa\n\
@@ -1020,7 +1020,7 @@ mod test {
                           dummy.txt: 9 ddd__eee_\n\
                        \x20              ^    ^\n\
                        \x20            ...\n\
-                          dummy.txt:11 _ff_gg\n\
+                          dummy.txt:11 __f_gg\n\
                        \x20              ^  ^\n";
 
         let expect0_end = "dummy.txt: 5 ccccc\n\
@@ -1031,7 +1031,7 @@ mod test {
                            dummy.txt: 9 ddd__eee_\n\
                         \x20              ^    ^\n\
                         \x20            ...\n\
-                           dummy.txt:11 _ff_gg\n\
+                           dummy.txt:11 __f_gg\n\
                         \x20              ^  ^\n";
 
         let expect_end_g1 = "dummy.txt:1 aaaaa\n\
@@ -1042,7 +1042,7 @@ mod test {
         let expect2_end = "dummy.txt: 9 ddd__eee_\n\
                         \x20              ^    ^\n\
                         \x20            ...\n\
-                           dummy.txt:11 _ff_gg\n\
+                           dummy.txt:11 __f_gg\n\
                         \x20              ^  ^\n";
 
         let expect_groups = [expect2, expect_g1];