Always show end line of multiline annotations

```rust
error[E0046]: not all trait items implemented, missing: `Item`
  --> $DIR/issue-23729.rs:20:9
   |
20 |           impl Iterator for Recurrence {
   |  _________^ starting here...
21 | |             //~^ ERROR E0046
22 | |             //~| NOTE missing `Item` in implementation
23 | |             //~| NOTE `Item` from trait: `type Item;`
...  |
36 | |             }
37 | |         }
   | |_________^ ...ending here: missing `Item` in implementation
   |
   = note: `Item` from trait: `type Item;`
```

instead of

```rust
error[E0046]: not all trait items implemented, missing: `Item`
  --> $DIR/issue-23729.rs:20:9
   |
20 |         impl Iterator for Recurrence {
   |         ^ missing `Item` in implementation
   |
   = note: `Item` from trait: `type Item;`
```
This commit is contained in:
Esteban Küber 2017-04-06 12:18:18 -07:00
parent 9e84bf8096
commit 4bc7f5b52c
6 changed files with 269 additions and 97 deletions

View file

@ -932,3 +932,137 @@ error: foo
"#);
}
#[test]
fn long_snippet() {
test_harness(r#"
fn foo() {
X0 Y0 Z0
X1 Y1 Z1
1
2
3
4
5
6
7
8
9
10
X2 Y2 Z2
X3 Y3 Z3
}
"#,
vec![
SpanLabel {
start: Position {
string: "Y0",
count: 1,
},
end: Position {
string: "X1",
count: 1,
},
label: "`X` is a good letter",
},
SpanLabel {
start: Position {
string: "Z1",
count: 1,
},
end: Position {
string: "Z3",
count: 1,
},
label: "`Y` is a good letter too",
},
],
r#"
error: foo
--> test.rs:3:6
|
3 | X0 Y0 Z0
| ______^ starting here...
4 | | X1 Y1 Z1
| |____^____- starting here...
| ||____|
| | ...ending here: `X` is a good letter
5 | | 1
6 | | 2
7 | | 3
... |
15 | | X2 Y2 Z2
16 | | X3 Y3 Z3
| |___________- ...ending here: `Y` is a good letter too
"#);
}
#[test]
fn long_snippet_multiple_spans() {
test_harness(r#"
fn foo() {
X0 Y0 Z0
1
2
3
X1 Y1 Z1
4
5
6
X2 Y2 Z2
7
8
9
10
X3 Y3 Z3
}
"#,
vec![
SpanLabel {
start: Position {
string: "Y0",
count: 1,
},
end: Position {
string: "Y3",
count: 1,
},
label: "`Y` is a good letter",
},
SpanLabel {
start: Position {
string: "Z1",
count: 1,
},
end: Position {
string: "Z2",
count: 1,
},
label: "`Z` is a good letter too",
},
],
r#"
error: foo
--> test.rs:3:6
|
3 | X0 Y0 Z0
| ______^ starting here...
4 | | 1
5 | | 2
6 | | 3
7 | | X1 Y1 Z1
| |_________- starting here...
8 | || 4
9 | || 5
10 | || 6
11 | || X2 Y2 Z2
| ||__________- ...ending here: `Z` is a good letter too
... |
15 | | 10
16 | | X3 Y3 Z3
| |_______^ ...ending here: `Y` is a good letter
"#);
}