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

+1-1
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

+4-4
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

+1-1
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

+1-1
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

+1-1
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

+1-1
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

+1-1
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

+2-2
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

+2-2
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

+1-1
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

src/test/ui-fulldeps/lint-plugin-deny-attr.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error: item is named 'lintme'
22
--> $DIR/lint-plugin-deny-attr.rs:8:1
33
|
4-
LL | fn lintme() { } //~ ERROR item is named 'lintme'
4+
LL | fn lintme() { }
55
| ^^^^^^^^^^^^^^^
66
|
77
note: lint level defined here

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error: item is named 'lintme'
22
--> $DIR/lint-plugin-deny-cmdline.rs:8:1
33
|
4-
LL | fn lintme() { } //~ ERROR item is named 'lintme'
4+
LL | fn lintme() { }
55
| ^^^^^^^^^^^^^^^
66
|
77
= note: requested on the command line with `-D test-lint`

src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ LL | #[allow(test_lint)]
1010
error: item is named 'lintme'
1111
--> $DIR/lint-plugin-forbid-attrs.rs:8:1
1212
|
13-
LL | fn lintme() { } //~ ERROR item is named 'lintme'
13+
LL | fn lintme() { }
1414
| ^^^^^^^^^^^^^^^
1515
|
1616
note: lint level defined here

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
error[E0453]: allow(test_lint) overruled by outer forbid(test_lint)
22
--> $DIR/lint-plugin-forbid-cmdline.rs:10:9
33
|
4-
LL | #[allow(test_lint)] //~ ERROR allow(test_lint) overruled by outer forbid(test_lint)
4+
LL | #[allow(test_lint)]
55
| ^^^^^^^^^ overruled by previous forbid
66
|
77
= note: `forbid` lint level was set on command line
88

99
error: item is named 'lintme'
1010
--> $DIR/lint-plugin-forbid-cmdline.rs:8:1
1111
|
12-
LL | fn lintme() { } //~ ERROR item is named 'lintme'
12+
LL | fn lintme() { }
1313
| ^^^^^^^^^^^^^^^
1414
|
1515
= note: requested on the command line with `-F test-lint`

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
warning: item is named 'lintme'
22
--> $DIR/lint-plugin.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

src/test/ui-fulldeps/lint_tool_test.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ LL | #[allow(test_group)]
2121
warning: unknown lint: `this_lint_does_not_exist`
2222
--> $DIR/lint_tool_test.rs:27:8
2323
|
24-
LL | #[deny(this_lint_does_not_exist)] //~ WARNING unknown lint: `this_lint_does_not_exist`
24+
LL | #[deny(this_lint_does_not_exist)]
2525
| ^^^^^^^^^^^^^^^^^^^^^^^^
2626
|
2727
= note: #[warn(unknown_lints)] on by default
@@ -35,7 +35,7 @@ LL | #![cfg_attr(foo, warn(test_lint))]
3535
error: item is named 'lintme'
3636
--> $DIR/lint_tool_test.rs:14:1
3737
|
38-
LL | fn lintme() { } //~ ERROR item is named 'lintme'
38+
LL | fn lintme() { }
3939
| ^^^^^^^^^^^^^^^
4040
|
4141
note: lint level defined here
@@ -48,7 +48,7 @@ LL | #![deny(clippy_group)]
4848
error: item is named 'lintmetoo'
4949
--> $DIR/lint_tool_test.rs:22:5
5050
|
51-
LL | fn lintmetoo() { } //~ ERROR item is named 'lintmetoo'
51+
LL | fn lintmetoo() { }
5252
| ^^^^^^^^^^^^^^^^^^
5353
|
5454
note: lint level defined here

src/test/ui-fulldeps/plugin-as-extern-crate.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error: compiler plugin used as an ordinary library
22
--> $DIR/plugin-as-extern-crate.rs:10:1
33
|
4-
LL | extern crate attr_plugin_test; //~ ERROR compiler plugin used as an ordinary library
4+
LL | extern crate attr_plugin_test;
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
note: lint level defined here

src/test/ui/E0508.nll.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array
22
--> $DIR/E0508.rs:5:18
33
|
4-
LL | let _value = array[0]; //~ ERROR [E0508]
4+
LL | let _value = array[0];
55
| ^^^^^^^^
66
| |
77
| cannot move out of here

src/test/ui/E0508.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array
22
--> $DIR/E0508.rs:5:18
33
|
4-
LL | let _value = array[0]; //~ ERROR [E0508]
4+
LL | let _value = array[0];
55
| ^^^^^^^^
66
| |
77
| cannot move out of here

src/test/ui/E0583.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error[E0583]: file not found for module `module_that_doesnt_exist`
22
--> $DIR/E0583.rs:1:5
33
|
4-
LL | mod module_that_doesnt_exist; //~ ERROR E0583
4+
LL | mod module_that_doesnt_exist;
55
| ^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= help: name the file either module_that_doesnt_exist.rs or module_that_doesnt_exist/mod.rs inside the directory "$DIR"

src/test/ui/E0642.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
error[E0642]: patterns aren't allowed in methods without bodies
22
--> $DIR/E0642.rs:5:12
33
|
4-
LL | fn foo((x, y): (i32, i32)); //~ ERROR patterns aren't allowed in methods without bodies
4+
LL | fn foo((x, y): (i32, i32));
55
| ^^^^^^
66
help: give this argument a name or use an underscore to ignore it
77
|
8-
LL | fn foo(_: (i32, i32)); //~ ERROR patterns aren't allowed in methods without bodies
8+
LL | fn foo(_: (i32, i32));
99
| ^
1010

1111
error[E0642]: patterns aren't allowed in methods without bodies
1212
--> $DIR/E0642.rs:7:12
1313
|
14-
LL | fn bar((x, y): (i32, i32)) {} //~ ERROR patterns aren't allowed in methods without bodies
14+
LL | fn bar((x, y): (i32, i32)) {}
1515
| ^^^^^^
1616
help: give this argument a name or use an underscore to ignore it
1717
|
18-
LL | fn bar(_: (i32, i32)) {} //~ ERROR patterns aren't allowed in methods without bodies
18+
LL | fn bar(_: (i32, i32)) {}
1919
| ^
2020

2121
error[E0642]: patterns aren't allowed in methods without bodies
2222
--> $DIR/E0642.rs:9:15
2323
|
24-
LL | fn method(S { .. }: S) {} //~ ERROR patterns aren't allowed in methods without bodies
24+
LL | fn method(S { .. }: S) {}
2525
| ^^^^^^^^
2626
help: give this argument a name or use an underscore to ignore it
2727
|
28-
LL | fn method(_: S) {} //~ ERROR patterns aren't allowed in methods without bodies
28+
LL | fn method(_: S) {}
2929
| ^
3030

3131
error: aborting due to 3 previous errors

src/test/ui/E0662.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error[E0662]: input operand constraint contains '='
22
--> $DIR/E0662.rs:6:12
33
|
4-
LL | : "=test"("a") //~ ERROR E0662
4+
LL | : "=test"("a")
55
| ^^^^^^^
66

77
error: aborting due to previous error

src/test/ui/E0663.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error[E0663]: input operand constraint contains '+'
22
--> $DIR/E0663.rs:6:12
33
|
4-
LL | : "+test"("a") //~ ERROR E0663
4+
LL | : "+test"("a")
55
| ^^^^^^^
66

77
error: aborting due to previous error

src/test/ui/E0664.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error[E0664]: clobber should not be surrounded by braces
22
--> $DIR/E0664.rs:7:12
33
|
4-
LL | : "{eax}" //~ ERROR E0664
4+
LL | : "{eax}"
55
| ^^^^^^^
66

77
error: aborting due to previous error

src/test/ui/E0665.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error[E0665]: `Default` cannot be derived for enums, only structs
22
--> $DIR/E0665.rs:1:10
33
|
4-
LL | #[derive(Default)] //~ ERROR E0665
4+
LL | #[derive(Default)]
55
| ^^^^^^^
66

77
error: aborting due to previous error

src/test/ui/absolute-paths-in-nested-use-groups.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
error[E0433]: failed to resolve: crate root in paths can only be used in start position
22
--> $DIR/absolute-paths-in-nested-use-groups.rs:6:5
33
|
4-
LL | ::bar, //~ ERROR crate root in paths can only be used in start position
4+
LL | ::bar,
55
| ^ crate root in paths can only be used in start position
66

77
error[E0433]: failed to resolve: `super` in paths can only be used in start position
88
--> $DIR/absolute-paths-in-nested-use-groups.rs:7:5
99
|
10-
LL | super::bar, //~ ERROR `super` in paths can only be used in start position
10+
LL | super::bar,
1111
| ^^^^^ `super` in paths can only be used in start position
1212

1313
error[E0433]: failed to resolve: `self` in paths can only be used in start position
1414
--> $DIR/absolute-paths-in-nested-use-groups.rs:8:5
1515
|
16-
LL | self::bar, //~ ERROR `self` in paths can only be used in start position
16+
LL | self::bar,
1717
| ^^^^ `self` in paths can only be used in start position
1818

1919
error: aborting due to 3 previous errors

src/test/ui/access-mode-in-closures.nll.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error[E0507]: cannot move out of borrowed content
22
--> $DIR/access-mode-in-closures.rs:8:15
33
|
4-
LL | match *s { S(v) => v } //~ ERROR cannot move out
4+
LL | match *s { S(v) => v }
55
| ^^ - data moved here
66
| |
77
| cannot move out of borrowed content
@@ -10,7 +10,7 @@ LL | match *s { S(v) => v } //~ ERROR cannot move out
1010
note: move occurs because `v` has type `std::vec::Vec<isize>`, which does not implement the `Copy` trait
1111
--> $DIR/access-mode-in-closures.rs:8:22
1212
|
13-
LL | match *s { S(v) => v } //~ ERROR cannot move out
13+
LL | match *s { S(v) => v }
1414
| ^
1515

1616
error: aborting due to previous error

src/test/ui/access-mode-in-closures.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error[E0507]: cannot move out of borrowed content
22
--> $DIR/access-mode-in-closures.rs:8:15
33
|
4-
LL | match *s { S(v) => v } //~ ERROR cannot move out
4+
LL | match *s { S(v) => v }
55
| ^^ - hint: to prevent move, use `ref v` or `ref mut v`
66
| |
77
| cannot move out of borrowed content

src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error: return type should be `!`
22
--> $DIR/alloc-error-handler-bad-signature-1.rs:12:6
33
|
4-
LL | ) -> () //~ ERROR return type should be `!`
4+
LL | ) -> ()
55
| ^^
66

77
error: argument should be `Layout`
88
--> $DIR/alloc-error-handler-bad-signature-1.rs:11:11
99
|
10-
LL | info: &Layout, //~ ERROR argument should be `Layout`
10+
LL | info: &Layout,
1111
| ^^^^^^^
1212

1313
error: aborting due to 2 previous errors

src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error: return type should be `!`
22
--> $DIR/alloc-error-handler-bad-signature-2.rs:12:3
33
|
4-
LL | ) { //~ ERROR return type should be `!`
4+
LL | ) {
55
| ^
66

77
error: argument should be `Layout`
88
--> $DIR/alloc-error-handler-bad-signature-2.rs:11:11
99
|
10-
LL | info: Layout, //~ ERROR argument should be `Layout`
10+
LL | info: Layout,
1111
| ^^^^^^
1212

1313
error: aborting due to 2 previous errors

0 commit comments

Comments
 (0)