about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2022-11-23 14:28:45 -0800
committerEsteban Küber <esteban@kuber.com.ar>2022-11-28 00:11:12 -0800
commitab04080b56448c4bcd7e5b79215a1097e1a9b217 (patch)
treead4aa4cc7a3a92ed1f983ab3d9d94f94f7b89471 /compiler/rustc_errors/src
parent454784afba5bf35b5ff14ada0e31265ad1d75e73 (diff)
downloadrust-ab04080b56448c4bcd7e5b79215a1097e1a9b217.tar.gz
rust-ab04080b56448c4bcd7e5b79215a1097e1a9b217.zip
Change multiline span ASCII art visual order
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/emitter.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs
index bf20c7431e4..d22f3ca4214 100644
--- a/compiler/rustc_errors/src/emitter.rs
+++ b/compiler/rustc_errors/src/emitter.rs
@@ -2300,8 +2300,14 @@ impl FileWithAnnotatedLines {
         }
 
         let mut max_depth = 0; // max overlapping multiline spans
-        for (file, ann) in multiline_annotations {
+        for (_, ann) in &multiline_annotations {
             max_depth = max(max_depth, ann.depth);
+        }
+        // Change order of multispan depth to minimize the number of overlaps in the ASCII art.
+        for (_, a) in multiline_annotations.iter_mut() {
+            a.depth = max_depth - a.depth + 1;
+        }
+        for (file, ann) in multiline_annotations {
             let mut end_ann = ann.as_end();
             if !ann.overlaps_exactly {
                 // avoid output like