Change multiline span ASCII art visual order
This commit is contained in:
parent
454784afba
commit
ab04080b56
10 changed files with 111 additions and 105 deletions
|
@ -2300,8 +2300,14 @@ impl FileWithAnnotatedLines {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut max_depth = 0; // max overlapping multiline spans
|
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);
|
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();
|
let mut end_ann = ann.as_end();
|
||||||
if !ann.overlaps_exactly {
|
if !ann.overlaps_exactly {
|
||||||
// avoid output like
|
// avoid output like
|
||||||
|
|
|
@ -272,13 +272,13 @@ error: foo
|
||||||
--> test.rs:3:3
|
--> test.rs:3:3
|
||||||
|
|
|
|
||||||
3 | X0 Y0
|
3 | X0 Y0
|
||||||
| ____^__-
|
| ___^__-
|
||||||
| | ___|
|
| |___|
|
||||||
| ||
|
| ||
|
||||||
4 | || X1 Y1
|
4 | || X1 Y1
|
||||||
5 | || X2 Y2
|
5 | || X2 Y2
|
||||||
| ||____^__- `Y` is a good letter too
|
| ||____^__- `Y` is a good letter too
|
||||||
| |____|
|
| |_____|
|
||||||
| `X` is a good letter
|
| `X` is a good letter
|
||||||
|
|
||||||
"#,
|
"#,
|
||||||
|
@ -311,12 +311,12 @@ error: foo
|
||||||
--> test.rs:3:3
|
--> test.rs:3:3
|
||||||
|
|
|
|
||||||
3 | X0 Y0
|
3 | X0 Y0
|
||||||
| ____^__-
|
| ___^__-
|
||||||
| | ___|
|
| |___|
|
||||||
| ||
|
| ||
|
||||||
4 | || Y1 X1
|
4 | || Y1 X1
|
||||||
| ||____-__^ `X` is a good letter
|
| ||____-__^ `X` is a good letter
|
||||||
| |_____|
|
| |____|
|
||||||
| `Y` is a good letter too
|
| `Y` is a good letter too
|
||||||
|
|
||||||
"#,
|
"#,
|
||||||
|
@ -351,13 +351,13 @@ error: foo
|
||||||
--> test.rs:3:6
|
--> test.rs:3:6
|
||||||
|
|
|
|
||||||
3 | X0 Y0 Z0
|
3 | X0 Y0 Z0
|
||||||
| ______^
|
| _______^
|
||||||
4 | | X1 Y1 Z1
|
4 | | X1 Y1 Z1
|
||||||
| |_________-
|
| | _________-
|
||||||
5 | || X2 Y2 Z2
|
5 | || X2 Y2 Z2
|
||||||
| ||____^ `X` is a good letter
|
| ||____^ `X` is a good letter
|
||||||
6 | | X3 Y3 Z3
|
6 | | X3 Y3 Z3
|
||||||
| |_____- `Y` is a good letter too
|
| |____- `Y` is a good letter too
|
||||||
|
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
|
@ -395,15 +395,15 @@ error: foo
|
||||||
--> test.rs:3:3
|
--> test.rs:3:3
|
||||||
|
|
|
|
||||||
3 | X0 Y0 Z0
|
3 | X0 Y0 Z0
|
||||||
| _____^__-__-
|
| ___^__-__-
|
||||||
| | ____|__|
|
| |___|__|
|
||||||
| || ___|
|
| ||___|
|
||||||
| |||
|
| |||
|
||||||
4 | ||| X1 Y1 Z1
|
4 | ||| X1 Y1 Z1
|
||||||
5 | ||| X2 Y2 Z2
|
5 | ||| X2 Y2 Z2
|
||||||
| |||____^__-__- `Z` label
|
| |||____^__-__- `Z` label
|
||||||
| ||____|__|
|
| ||_____|__|
|
||||||
| |____| `Y` is a good letter too
|
| |______| `Y` is a good letter too
|
||||||
| `X` is a good letter
|
| `X` is a good letter
|
||||||
|
|
||||||
"#,
|
"#,
|
||||||
|
@ -487,17 +487,17 @@ error: foo
|
||||||
--> test.rs:3:6
|
--> test.rs:3:6
|
||||||
|
|
|
|
||||||
3 | X0 Y0 Z0
|
3 | X0 Y0 Z0
|
||||||
| ______^
|
| _______^
|
||||||
4 | | X1 Y1 Z1
|
4 | | X1 Y1 Z1
|
||||||
| |____^_-
|
| | ____^_-
|
||||||
| ||____|
|
| ||____|
|
||||||
| | `X` is a good letter
|
| | `X` is a good letter
|
||||||
5 | | X2 Y2 Z2
|
5 | | X2 Y2 Z2
|
||||||
| |____-______- `Y` is a good letter too
|
| |___-______- `Y` is a good letter too
|
||||||
| ____|
|
| ___|
|
||||||
| |
|
| |
|
||||||
6 | | X3 Y3 Z3
|
6 | | X3 Y3 Z3
|
||||||
| |________- `Z`
|
| |_______- `Z`
|
||||||
|
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
|
@ -570,14 +570,14 @@ error: foo
|
||||||
--> test.rs:3:6
|
--> test.rs:3:6
|
||||||
|
|
|
|
||||||
3 | X0 Y0 Z0
|
3 | X0 Y0 Z0
|
||||||
| ______^
|
| _______^
|
||||||
4 | | X1 Y1 Z1
|
4 | | X1 Y1 Z1
|
||||||
| |____^____-
|
| | ____^____-
|
||||||
| ||____|
|
| ||____|
|
||||||
| | `X` is a good letter
|
| | `X` is a good letter
|
||||||
5 | | X2 Y2 Z2
|
5 | | X2 Y2 Z2
|
||||||
6 | | X3 Y3 Z3
|
6 | | X3 Y3 Z3
|
||||||
| |___________- `Y` is a good letter too
|
| |__________- `Y` is a good letter too
|
||||||
|
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
|
@ -941,9 +941,9 @@ error: foo
|
||||||
--> test.rs:3:6
|
--> test.rs:3:6
|
||||||
|
|
|
|
||||||
3 | X0 Y0 Z0
|
3 | X0 Y0 Z0
|
||||||
| ______^
|
| _______^
|
||||||
4 | | X1 Y1 Z1
|
4 | | X1 Y1 Z1
|
||||||
| |____^____-
|
| | ____^____-
|
||||||
| ||____|
|
| ||____|
|
||||||
| | `X` is a good letter
|
| | `X` is a good letter
|
||||||
5 | | 1
|
5 | | 1
|
||||||
|
@ -952,7 +952,7 @@ error: foo
|
||||||
... |
|
... |
|
||||||
15 | | X2 Y2 Z2
|
15 | | X2 Y2 Z2
|
||||||
16 | | X3 Y3 Z3
|
16 | | X3 Y3 Z3
|
||||||
| |___________- `Y` is a good letter too
|
| |__________- `Y` is a good letter too
|
||||||
|
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
|
@ -996,12 +996,12 @@ error: foo
|
||||||
--> test.rs:3:6
|
--> test.rs:3:6
|
||||||
|
|
|
|
||||||
3 | X0 Y0 Z0
|
3 | X0 Y0 Z0
|
||||||
| ______^
|
| _______^
|
||||||
4 | | 1
|
4 | | 1
|
||||||
5 | | 2
|
5 | | 2
|
||||||
6 | | 3
|
6 | | 3
|
||||||
7 | | X1 Y1 Z1
|
7 | | X1 Y1 Z1
|
||||||
| |_________-
|
| | _________-
|
||||||
8 | || 4
|
8 | || 4
|
||||||
9 | || 5
|
9 | || 5
|
||||||
10 | || 6
|
10 | || 6
|
||||||
|
@ -1010,7 +1010,7 @@ error: foo
|
||||||
... |
|
... |
|
||||||
15 | | 10
|
15 | | 10
|
||||||
16 | | X3 Y3 Z3
|
16 | | X3 Y3 Z3
|
||||||
| |_______^ `Y` is a good letter
|
| |________^ `Y` is a good letter
|
||||||
|
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
|
|
|
@ -4,8 +4,8 @@ error[E0308]: mismatched types
|
||||||
LL | #[alloc_error_handler]
|
LL | #[alloc_error_handler]
|
||||||
| ---------------------- in this procedural macro expansion
|
| ---------------------- in this procedural macro expansion
|
||||||
LL | fn oom(
|
LL | fn oom(
|
||||||
| _^
|
| __^
|
||||||
| |_|
|
| | _|
|
||||||
| ||
|
| ||
|
||||||
LL | || info: &Layout,
|
LL | || info: &Layout,
|
||||||
LL | || ) -> ()
|
LL | || ) -> ()
|
||||||
|
@ -13,7 +13,7 @@ LL | || ) -> ()
|
||||||
LL | | {
|
LL | | {
|
||||||
LL | | loop {}
|
LL | | loop {}
|
||||||
LL | | }
|
LL | | }
|
||||||
| |__^ expected `&Layout`, found struct `Layout`
|
| |_^ expected `&Layout`, found struct `Layout`
|
||||||
|
|
|
|
||||||
note: function defined here
|
note: function defined here
|
||||||
--> $DIR/alloc-error-handler-bad-signature-1.rs:10:4
|
--> $DIR/alloc-error-handler-bad-signature-1.rs:10:4
|
||||||
|
@ -30,8 +30,8 @@ error[E0308]: mismatched types
|
||||||
LL | #[alloc_error_handler]
|
LL | #[alloc_error_handler]
|
||||||
| ---------------------- in this procedural macro expansion
|
| ---------------------- in this procedural macro expansion
|
||||||
LL | fn oom(
|
LL | fn oom(
|
||||||
| _^
|
| __^
|
||||||
| |_|
|
| | _|
|
||||||
| ||
|
| ||
|
||||||
LL | || info: &Layout,
|
LL | || info: &Layout,
|
||||||
LL | || ) -> ()
|
LL | || ) -> ()
|
||||||
|
@ -39,7 +39,7 @@ LL | || ) -> ()
|
||||||
LL | | {
|
LL | | {
|
||||||
LL | | loop {}
|
LL | | loop {}
|
||||||
LL | | }
|
LL | | }
|
||||||
| |__- expected `!` because of return type
|
| |_- expected `!` because of return type
|
||||||
|
|
|
|
||||||
= note: expected type `!`
|
= note: expected type `!`
|
||||||
found unit type `()`
|
found unit type `()`
|
||||||
|
|
|
@ -4,8 +4,8 @@ error[E0308]: mismatched types
|
||||||
LL | #[alloc_error_handler]
|
LL | #[alloc_error_handler]
|
||||||
| ---------------------- in this procedural macro expansion
|
| ---------------------- in this procedural macro expansion
|
||||||
LL | fn oom(
|
LL | fn oom(
|
||||||
| _^
|
| __^
|
||||||
| |_|
|
| | _|
|
||||||
| ||
|
| ||
|
||||||
LL | || info: Layout,
|
LL | || info: Layout,
|
||||||
LL | || ) {
|
LL | || ) {
|
||||||
|
@ -14,7 +14,7 @@ LL | || ) {
|
||||||
| | arguments to this function are incorrect
|
| | arguments to this function are incorrect
|
||||||
LL | | loop {}
|
LL | | loop {}
|
||||||
LL | | }
|
LL | | }
|
||||||
| |__^ expected struct `Layout`, found struct `core::alloc::Layout`
|
| |_^ expected struct `Layout`, found struct `core::alloc::Layout`
|
||||||
|
|
|
|
||||||
= note: struct `core::alloc::Layout` and struct `Layout` have similar names, but are actually distinct types
|
= note: struct `core::alloc::Layout` and struct `Layout` have similar names, but are actually distinct types
|
||||||
note: struct `core::alloc::Layout` is defined in crate `core`
|
note: struct `core::alloc::Layout` is defined in crate `core`
|
||||||
|
@ -42,8 +42,8 @@ error[E0308]: mismatched types
|
||||||
LL | #[alloc_error_handler]
|
LL | #[alloc_error_handler]
|
||||||
| ---------------------- in this procedural macro expansion
|
| ---------------------- in this procedural macro expansion
|
||||||
LL | fn oom(
|
LL | fn oom(
|
||||||
| _^
|
| __^
|
||||||
| |_|
|
| | _|
|
||||||
| ||
|
| ||
|
||||||
LL | || info: Layout,
|
LL | || info: Layout,
|
||||||
LL | || ) {
|
LL | || ) {
|
||||||
|
@ -52,7 +52,7 @@ LL | || ) {
|
||||||
| | expected `!`, found `()`
|
| | expected `!`, found `()`
|
||||||
LL | | loop {}
|
LL | | loop {}
|
||||||
LL | | }
|
LL | | }
|
||||||
| |__- expected `!` because of return type
|
| |_- expected `!` because of return type
|
||||||
|
|
|
|
||||||
= note: expected type `!`
|
= note: expected type `!`
|
||||||
found unit type `()`
|
found unit type `()`
|
||||||
|
|
|
@ -157,11 +157,11 @@ error[E0308]: `if` and `else` have incompatible types
|
||||||
--> $DIR/deref-suggestion.rs:69:12
|
--> $DIR/deref-suggestion.rs:69:12
|
||||||
|
|
|
|
||||||
LL | let val = if true {
|
LL | let val = if true {
|
||||||
| _______________-
|
| ________________-
|
||||||
LL | | *a
|
LL | | *a
|
||||||
| | -- expected because of this
|
| | -- expected because of this
|
||||||
LL | | } else if true {
|
LL | | } else if true {
|
||||||
| |____________^
|
| | ____________^
|
||||||
LL | ||
|
LL | ||
|
||||||
LL | || b
|
LL | || b
|
||||||
LL | || } else {
|
LL | || } else {
|
||||||
|
@ -169,7 +169,7 @@ LL | || &0
|
||||||
LL | || };
|
LL | || };
|
||||||
| || ^
|
| || ^
|
||||||
| ||_____|
|
| ||_____|
|
||||||
| |______`if` and `else` have incompatible types
|
| |_____`if` and `else` have incompatible types
|
||||||
| expected `i32`, found `&{integer}`
|
| expected `i32`, found `&{integer}`
|
||||||
|
|
||||||
error: aborting due to 13 previous errors
|
error: aborting due to 13 previous errors
|
||||||
|
|
|
@ -2,12 +2,12 @@ error[E0515]: cannot return value referencing local variable `rawLines`
|
||||||
--> $DIR/issue-13497-2.rs:3:5
|
--> $DIR/issue-13497-2.rs:3:5
|
||||||
|
|
|
|
||||||
LL | rawLines
|
LL | rawLines
|
||||||
| _____^
|
| ______^
|
||||||
| |_____|
|
| | _____|
|
||||||
| ||
|
| ||
|
||||||
LL | || .iter().map(|l| l.trim()).collect()
|
LL | || .iter().map(|l| l.trim()).collect()
|
||||||
| ||_______________-___________________________^ returns a value referencing data owned by the current function
|
| ||_______________-___________________________^ returns a value referencing data owned by the current function
|
||||||
| |________________|
|
| |_______________|
|
||||||
| `rawLines` is borrowed here
|
| `rawLines` is borrowed here
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
|
@ -41,12 +41,12 @@ warning: variable does not need to be mutable
|
||||||
--> $DIR/suggestions.rs:54:13
|
--> $DIR/suggestions.rs:54:13
|
||||||
|
|
|
|
||||||
LL | let mut
|
LL | let mut
|
||||||
| _____________^
|
| ______________^
|
||||||
| |_____________|
|
| | _____________|
|
||||||
| ||
|
| ||
|
||||||
LL | || b = 1;
|
LL | || b = 1;
|
||||||
| ||____________-^
|
| ||____________-^
|
||||||
| |____________|
|
| |_____________|
|
||||||
| help: remove this `mut`
|
| help: remove this `mut`
|
||||||
|
|
||||||
error: const items should never be `#[no_mangle]`
|
error: const items should never be `#[no_mangle]`
|
||||||
|
|
|
@ -38,14 +38,14 @@ error[E0572]: return statement outside of function body
|
||||||
LL | / fn main() {
|
LL | / fn main() {
|
||||||
LL | |
|
LL | |
|
||||||
LL | | [(); return || {
|
LL | | [(); return || {
|
||||||
| |__________^
|
| | __________^
|
||||||
LL | ||
|
LL | ||
|
||||||
LL | ||
|
LL | ||
|
||||||
LL | || let tx;
|
LL | || let tx;
|
||||||
LL | || }];
|
LL | || }];
|
||||||
| ||_____^ the return is part of this body...
|
| ||_____^ the return is part of this body...
|
||||||
LL | | }
|
LL | | }
|
||||||
| |_- ...not the enclosing function body
|
| |__- ...not the enclosing function body
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,12 @@ LL | Unit,
|
||||||
| ---- enum variant `Alias::Unit` defined here
|
| ---- enum variant `Alias::Unit` defined here
|
||||||
...
|
...
|
||||||
LL | Alias::
|
LL | Alias::
|
||||||
| _____^
|
| ______^
|
||||||
| |_____|
|
| | _____|
|
||||||
| ||
|
| ||
|
||||||
LL | || Unit();
|
LL | || Unit();
|
||||||
| ||________^_- call expression requires function
|
| ||________^_- call expression requires function
|
||||||
| |_________|
|
| |________|
|
||||||
|
|
|
|
||||||
|
|
|
|
||||||
help: `Alias::Unit` is a unit enum variant, and does not take parentheses to be constructed
|
help: `Alias::Unit` is a unit enum variant, and does not take parentheses to be constructed
|
||||||
|
|
|
@ -2,14 +2,14 @@ error[E0277]: `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>` is not an iterat
|
||||||
--> $DIR/suggest-remove-refs-3.rs:6:19
|
--> $DIR/suggest-remove-refs-3.rs:6:19
|
||||||
|
|
|
|
||||||
LL | for (i, _) in & & &
|
LL | for (i, _) in & & &
|
||||||
| ___________________^
|
| ____________________^
|
||||||
| |___________________|
|
| | ___________________|
|
||||||
| ||
|
| ||
|
||||||
LL | || & &v
|
LL | || & &v
|
||||||
| ||___________- help: consider removing 5 leading `&`-references
|
| ||___________- help: consider removing 5 leading `&`-references
|
||||||
LL | | .iter()
|
LL | | .iter()
|
||||||
LL | | .enumerate() {
|
LL | | .enumerate() {
|
||||||
| |_____________________^ `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>` is not an iterator
|
| |____________________^ `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>` is not an iterator
|
||||||
|
|
|
|
||||||
= help: the trait `Iterator` is not implemented for `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>`
|
= help: the trait `Iterator` is not implemented for `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>`
|
||||||
= note: required for `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>` to implement `IntoIterator`
|
= note: required for `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>` to implement `IntoIterator`
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue