diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2022-11-23 14:28:45 -0800 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2022-11-28 00:11:12 -0800 |
| commit | ab04080b56448c4bcd7e5b79215a1097e1a9b217 (patch) | |
| tree | ad4aa4cc7a3a92ed1f983ab3d9d94f94f7b89471 /compiler/rustc_errors/src | |
| parent | 454784afba5bf35b5ff14ada0e31265ad1d75e73 (diff) | |
| download | rust-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.rs | 8 |
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 |
