about summary refs log tree commit diff
path: root/src/librustc_errors
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2019-03-28 20:18:50 -0700
committerEsteban Küber <esteban@kuber.com.ar>2019-03-28 20:18:50 -0700
commit8fad69c2001ebe78d67e193f05969bb6f681b109 (patch)
tree9539d2daa32b4cd13330407be4504609bb9d7a37 /src/librustc_errors
parente13e9a5d636116455aab6940d27bbc1b450aa003 (diff)
downloadrust-8fad69c2001ebe78d67e193f05969bb6f681b109.tar.gz
rust-8fad69c2001ebe78d67e193f05969bb6f681b109.zip
Add comemnts clarifying logic
Diffstat (limited to 'src/librustc_errors')
-rw-r--r--src/librustc_errors/emitter.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs
index d2c9db2db79..98db0097c74 100644
--- a/src/librustc_errors/emitter.rs
+++ b/src/librustc_errors/emitter.rs
@@ -314,8 +314,13 @@ impl EmitterWriter {
                 //  | |______foo
                 //  |        baz
                 add_annotation_to_file(&mut output, file.clone(), ann.line_start, ann.as_start());
+                // 4 is the minimum vertical length of a multiline span when presented: two lines
+                // of code and two lines of underline. This is not true for the special case where
+                // the beginning doesn't have an underline, but the current logic seems to be
+                // working correctly.
                 let middle = min(ann.line_start + 4, ann.line_end);
                 for line in ann.line_start + 1..middle {
+                    // Every `|` that joins the beginning of the span (`___^`) to the end (`|__^`).
                     add_annotation_to_file(&mut output, file.clone(), line, ann.as_line());
                 }
                 if middle < ann.line_end - 1 {