From ab04080b56448c4bcd7e5b79215a1097e1a9b217 Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Wed, 23 Nov 2022 14:28:45 -0800 Subject: Change multiline span ASCII art visual order --- compiler/rustc_errors/src/emitter.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'compiler/rustc_errors/src') 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 -- cgit 1.4.1-3-g733a5