Skip to content

Commit 7486b9c

Browse files
committed
Auto merge of #59044 - petrochenkov:uiui, r=davidtwco
Filter away test annotations from UI test output If you worked with UI tests for some time you could notice one issue affecting their readability and also readability of diffs when the tests change. Look at the output of this test. ```rust fn main() { let 1 = 2; //~ ERROR refutable pattern in local binding } ``` ``` error[E0005]: refutable pattern in local binding: `-2147483648i32..=0i32` not covered --> src/main.rs:2:9 | 2 | let 1 = 2; //~ ERROR refutable pattern in local binding | ^ pattern `-2147483648i32..=0i32` not covered error: aborting due to previous error For more information about this error, try `rustc --explain E0005`. ``` You can see that the "refutable pattern in local binding" is duplicated. One instance is the actual error, and the second instance is the expected error annotation. This annotation is useful in the test input, but in the output it clutters the text and makes it harder to see what text refers to actual errors and what is just comments, especially if there are many errors in a single test file. @estebank [reported](#57379 (comment)) using the next trick to avoid the clutter ```rust fn main() { let 1 = 2; //~^ ERROR refutable pattern in local binding } ``` ``` error[E0005]: refutable pattern in local binding: `-2147483648i32..=0i32` not covered --> src/main.rs:2:9 | 2 | let 1 = 2; | ^ pattern `-2147483648i32..=0i32` not covered error: aborting due to previous error For more information about this error, try `rustc --explain E0005`. ``` , i.e. using `//~^` and placing the annotation one line below will remove the annotation from the output. However, this doesn't always works (consider errors with multi-line spans), and shouldn't be necessary in general! `compiletest` could automatically filter away its own annotations from the output instead. This is exactly what this PR does. r? @davidtwco
2 parents e68bf8a + 07f99b9 commit 7486b9c

File tree

2,940 files changed

+7506
-7548
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,940 files changed

+7506
-7548
lines changed

src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error: `[v2]` cannot be resolved, ignoring it...
22
--> $DIR/deny-intra-link-resolution-failure.rs:3:6
33
|
4-
LL | /// [v2] //~ ERROR
4+
LL | /// [v2]
55
| ^^ cannot be resolved, ignoring
66
|
77
note: lint level defined here

src/test/rustdoc-ui/deny-missing-docs-crate.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
error: missing documentation for crate
22
--> $DIR/deny-missing-docs-crate.rs:1:1
33
|
4-
LL | / #![deny(missing_docs)] //~ ERROR
4+
LL | / #![deny(missing_docs)]
55
LL | |
6-
LL | | pub struct Foo; //~ ERROR
6+
LL | | pub struct Foo;
77
| |_______________^
88
|
99
note: lint level defined here
1010
--> $DIR/deny-missing-docs-crate.rs:1:9
1111
|
12-
LL | #![deny(missing_docs)] //~ ERROR
12+
LL | #![deny(missing_docs)]
1313
| ^^^^^^^^^^^^
1414

1515
error: missing documentation for a struct
1616
--> $DIR/deny-missing-docs-crate.rs:3:1
1717
|
18-
LL | pub struct Foo; //~ ERROR
18+
LL | pub struct Foo;
1919
| ^^^^^^^^^^^^^^^
2020

2121
error: aborting due to 2 previous errors

src/test/rustdoc-ui/deny-missing-docs-macro.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error: missing documentation for macro
22
--> $DIR/deny-missing-docs-macro.rs:6:1
33
|
4-
LL | macro_rules! foo { //~ ERROR
4+
LL | macro_rules! foo {
55
| ^^^^^^^^^^^^^^^^
66
|
77
note: lint level defined here

src/test/rustdoc-ui/intra-doc-alias-ice.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error: `[TypeAlias::hoge]` cannot be resolved, ignoring it...
22
--> $DIR/intra-doc-alias-ice.rs:5:30
33
|
4-
LL | /// [broken cross-reference](TypeAlias::hoge) //~ ERROR
4+
LL | /// [broken cross-reference](TypeAlias::hoge)
55
| ^^^^^^^^^^^^^^^ cannot be resolved, ignoring
66
|
77
note: lint level defined here

src/test/ui-fulldeps/dropck_tarena_cycle_checked.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ error[E0597]: `arena` does not live long enough
33
|
44
LL | f(&arena);
55
| ^^^^^ borrowed value does not live long enough
6-
LL | } //~^ ERROR `arena` does not live long enough
6+
LL | }
77
| - `arena` dropped here while still borrowed
88
|
99
= note: values in a scope are dropped in the opposite order they are created

src/test/ui-fulldeps/dropck_tarena_unsound_drop.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ error[E0597]: `arena` does not live long enough
33
|
44
LL | f(&arena);
55
| ^^^^^ borrowed value does not live long enough
6-
LL | } //~^ ERROR `arena` does not live long enough
6+
LL | }
77
| - `arena` dropped here while still borrowed
88
|
99
= note: values in a scope are dropped in the opposite order they are created

src/test/ui-fulldeps/issue-15778-fail.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error: crate is not marked with #![crate_okay]
22
--> $DIR/issue-15778-fail.rs:5:1
33
|
4-
LL | / #![feature(plugin)] //~ ERROR crate is not marked with #![crate_okay]
4+
LL | / #![feature(plugin)]
55
LL | | #![plugin(lint_for_crate)]
66
LL | |
77
LL | | pub fn main() { }

src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
error: item is named 'lintme'
22
--> $DIR/lint-group-plugin-deny-cmdline.rs:8:1
33
|
4-
LL | fn lintme() { } //~ ERROR item is named 'lintme'
4+
LL | fn lintme() { }
55
| ^^^^^^^^^^^^^^^
66
|
77
= note: `-D test-lint` implied by `-D lint-me`
88

99
error: item is named 'pleaselintme'
1010
--> $DIR/lint-group-plugin-deny-cmdline.rs:10:1
1111
|
12-
LL | fn pleaselintme() { } //~ ERROR item is named 'pleaselintme'
12+
LL | fn pleaselintme() { }
1313
| ^^^^^^^^^^^^^^^^^^^^^
1414
|
1515
= note: `-D please-lint` implied by `-D lint-me`

src/test/ui-fulldeps/lint-group-plugin.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
warning: item is named 'lintme'
22
--> $DIR/lint-group-plugin.rs:9:1
33
|
4-
LL | fn lintme() { } //~ WARNING item is named 'lintme'
4+
LL | fn lintme() { }
55
| ^^^^^^^^^^^^^^^
66
|
77
= note: #[warn(test_lint)] on by default
88

99
warning: item is named 'pleaselintme'
1010
--> $DIR/lint-group-plugin.rs:10:1
1111
|
12-
LL | fn pleaselintme() { } //~ WARNING item is named 'pleaselintme'
12+
LL | fn pleaselintme() { }
1313
| ^^^^^^^^^^^^^^^^^^^^^
1414
|
1515
= note: #[warn(please_lint)] on by default

src/test/ui-fulldeps/lint-plugin-cmdline-load.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
warning: item is named 'lintme'
22
--> $DIR/lint-plugin-cmdline-load.rs:8:1
33
|
4-
LL | fn lintme() { } //~ WARNING item is named 'lintme'
4+
LL | fn lintme() { }
55
| ^^^^^^^^^^^^^^^
66
|
77
= note: #[warn(test_lint)] on by default

0 commit comments

Comments
 (0)