Skip to content

Commit 8fad69c

Browse files
committed
Add comemnts clarifying logic
1 parent e13e9a5 commit 8fad69c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/librustc_errors/emitter.rs

+5
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,13 @@ impl EmitterWriter {
314314
// | |______foo
315315
// | baz
316316
add_annotation_to_file(&mut output, file.clone(), ann.line_start, ann.as_start());
317+
// 4 is the minimum vertical length of a multiline span when presented: two lines
318+
// of code and two lines of underline. This is not true for the special case where
319+
// the beginning doesn't have an underline, but the current logic seems to be
320+
// working correctly.
317321
let middle = min(ann.line_start + 4, ann.line_end);
318322
for line in ann.line_start + 1..middle {
323+
// Every `|` that joins the beginning of the span (`___^`) to the end (`|__^`).
319324
add_annotation_to_file(&mut output, file.clone(), line, ann.as_line());
320325
}
321326
if middle < ann.line_end - 1 {

0 commit comments

Comments
 (0)