diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2019-03-27 19:26:47 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2019-03-27 19:35:30 -0700 |
| commit | 326ec800b952749d0afc90be0604dc0332d70324 (patch) | |
| tree | 6f20d0c76b39acb66d2cce95a2c6010700508941 /src/libsyntax | |
| parent | 925ca49cf12ef9ce328eb7ad66e63c4c86b02460 (diff) | |
| download | rust-326ec800b952749d0afc90be0604dc0332d70324.tar.gz rust-326ec800b952749d0afc90be0604dc0332d70324.zip | |
Account for fully overlapping multiline annotations
When two multiline span labels point at the same span, we special
case the output to avoid weird behavior:
```
foo(
_____^
|_____|
|| bar,
|| );
|| ^
||______|
|______foo
baz
```
instead showing
```
foo(
_____^
| bar,
| );
| ^
| |
|______foo
baz
```
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/test_snippet.rs | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/libsyntax/test_snippet.rs b/src/libsyntax/test_snippet.rs index 2b3d18835d5..86910ffd894 100644 --- a/src/libsyntax/test_snippet.rs +++ b/src/libsyntax/test_snippet.rs @@ -375,6 +375,66 @@ error: foo } #[test] +fn triple_exact_overlap() { + test_harness(r#" +fn foo() { + X0 Y0 Z0 + X1 Y1 Z1 + X2 Y2 Z2 +} +"#, + vec![ + SpanLabel { + start: Position { + string: "X0", + count: 1, + }, + end: Position { + string: "X2", + count: 1, + }, + label: "`X` is a good letter", + }, + SpanLabel { + start: Position { + string: "X0", + count: 1, + }, + end: Position { + string: "X2", + count: 1, + }, + label: "`Y` is a good letter too", + }, + SpanLabel { + start: Position { + string: "X0", + count: 1, + }, + end: Position { + string: "X2", + count: 1, + }, + label: "`Z` label", + }, + ], + r#" +error: foo + --> test.rs:3:3 + | +3 | / X0 Y0 Z0 +4 | | X1 Y1 Z1 +5 | | X2 Y2 Z2 + | | ^ + | | | + | | `X` is a good letter + | |____`Y` is a good letter too + | `Z` label + +"#); +} + +#[test] fn minimum_depth() { test_harness(r#" fn foo() { |
