Skip to content

Commit 1b5a923

Browse files
committed
Auto merge of #41968 - kennytm:fix-unreadable-json-test-output-36516, r=nikomatsakis
Introduce 'run-pass' header to 'ui' tests in compiletest. Fix issue #36516. <del>`ui-run` test is a combination of `ui` test and `run-pass` test. It is used to test lint output.</del> Added support of `// run-pass` header to `ui` tests. The compiler message of each test must match the corresponding `*.stderr` file like the traditional `ui` tests. Additionally, the compiled output must be executed successfully like the `run-pass` test. 12 `run-pass`/`run-pass-fulldeps` tests are moved to `ui`/`ui-fulldeps` plus the headers. After this move, no `run-pass`/`run-pass-fulldeps` tests should rely on the compiler's JSON message. This allows us to stop passing `--error-format json` in run-pass tests, thus fixing #36516.
2 parents efee86d + 3e6c83d commit 1b5a923

30 files changed

+250
-35
lines changed

src/test/codegen/fastcall-inreg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
// ignore-tce
3838
// ignore-thumb
3939
// ignore-thumbeb
40-
// ignore-x86_64 no-ignore-x86
40+
// ignore-x86_64
4141
// ignore-xcore
4242
// ignore-nvptx
4343
// ignore-nvptx64

src/test/run-pass/i128-ffi.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
// ignore-windows
1616

1717
// Ignore 32 bit targets:
18-
// ignore-x86, ignore-arm
18+
// ignore-x86
19+
// ignore-arm
1920

2021
// ignore-emscripten
2122

src/test/run-pass-fulldeps/deprecated-derive.rs renamed to src/test/ui-fulldeps/deprecated-derive.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// run-pass
12+
1113
#![feature(rustc_private)]
1214
#![allow(dead_code)]
1315

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
warning: derive(Encodable) is deprecated in favor of derive(RustcEncodable)
2+
--> $DIR/deprecated-derive.rs:18:10
3+
|
4+
18 | #[derive(Encodable)]
5+
| ^^^^^^^^^
6+

src/test/run-pass-fulldeps/lint-group-plugin.rs renamed to src/test/ui-fulldeps/lint-group-plugin.rs

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// run-pass
1112
// aux-build:lint_group_plugin_test.rs
1213
// ignore-stage1
1314
#![feature(plugin)]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
warning: item is named 'lintme'
2+
--> $DIR/lint-group-plugin.rs:18:1
3+
|
4+
18 | fn lintme() { } //~ WARNING item is named 'lintme'
5+
| ^^^^^^^^^^^^^^^
6+
|
7+
= note: #[warn(test_lint)] on by default
8+
9+
warning: item is named 'pleaselintme'
10+
--> $DIR/lint-group-plugin.rs:19:1
11+
|
12+
19 | fn pleaselintme() { } //~ WARNING item is named 'pleaselintme'
13+
| ^^^^^^^^^^^^^^^^^^^^^
14+
|
15+
= note: #[warn(please_lint)] on by default
16+

src/test/run-pass-fulldeps/lint-plugin-cmdline-allow.rs renamed to src/test/ui-fulldeps/lint-plugin-cmdline-allow.rs

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// run-pass
1112
// aux-build:lint_plugin_test.rs
1213
// ignore-stage1
1314
// compile-flags: -A test-lint
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
warning: function is never used: `lintme`
2+
--> $DIR/lint-plugin-cmdline-allow.rs:19:1
3+
|
4+
19 | fn lintme() { }
5+
| ^^^^^^^^^^^^^^^
6+
|
7+
= note: #[warn(dead_code)] on by default
8+

src/test/run-pass-fulldeps/lint-plugin-cmdline-load.rs renamed to src/test/ui-fulldeps/lint-plugin-cmdline-load.rs

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// run-pass
1112
// aux-build:lint_plugin_test.rs
1213
// ignore-stage1
1314
// compile-flags: -Z extra-plugins=lint_plugin_test
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
warning: item is named 'lintme'
2+
--> $DIR/lint-plugin-cmdline-load.rs:18:1
3+
|
4+
18 | fn lintme() { } //~ WARNING item is named 'lintme'
5+
| ^^^^^^^^^^^^^^^
6+
|
7+
= note: #[warn(test_lint)] on by default
8+

src/test/run-pass-fulldeps/lint-plugin.rs renamed to src/test/ui-fulldeps/lint-plugin.rs

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// run-pass
1112
// aux-build:lint_plugin_test.rs
1213
// ignore-stage1
1314
#![feature(plugin)]
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
warning: item is named 'lintme'
2+
--> $DIR/lint-plugin.rs:18:1
3+
|
4+
18 | fn lintme() { } //~ WARNING item is named 'lintme'
5+
| ^^^^^^^^^^^^^^^
6+
|
7+
= note: #[warn(test_lint)] on by default
8+

src/test/run-pass/deprecated-macro_escape-inner.rs renamed to src/test/ui/deprecated-macro_escape-inner.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// run-pass
12+
1113
mod foo {
1214
#![macro_escape] //~ WARNING macro_escape is a deprecated synonym for macro_use
1315
//~^ HELP consider an outer attribute
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
warning: macro_escape is a deprecated synonym for macro_use
2+
--> $DIR/deprecated-macro_escape-inner.rs:14:5
3+
|
4+
14 | #![macro_escape] //~ WARNING macro_escape is a deprecated synonym for macro_use
5+
| ^^^^^^^^^^^^^^^^
6+
|
7+
= help: consider an outer attribute, #[macro_use] mod ...
8+

src/test/run-pass/deprecated-macro_escape.rs renamed to src/test/ui/deprecated-macro_escape.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// run-pass
12+
1113
#[macro_escape] //~ WARNING macro_escape is a deprecated synonym for macro_use
1214
mod foo {
1315
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
warning: macro_escape is a deprecated synonym for macro_use
2+
--> $DIR/deprecated-macro_escape.rs:13:1
3+
|
4+
13 | #[macro_escape] //~ WARNING macro_escape is a deprecated synonym for macro_use
5+
| ^^^^^^^^^^^^^^^
6+

src/test/run-pass/deriving-meta-empty-trait-list.rs renamed to src/test/ui/deriving-meta-empty-trait-list.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// run-pass
12+
1113
#![allow(dead_code)]
1214

1315
#[derive] //~ WARNING empty trait list in `derive`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
warning: empty trait list in `derive`
2+
--> $DIR/deriving-meta-empty-trait-list.rs:15:1
3+
|
4+
15 | #[derive] //~ WARNING empty trait list in `derive`
5+
| ^^^^^^^^^
6+
7+
warning: empty trait list in `derive`
8+
--> $DIR/deriving-meta-empty-trait-list.rs:18:1
9+
|
10+
18 | #[derive()] //~ WARNING empty trait list in `derive`
11+
| ^^^^^^^^^^^
12+

src/test/run-pass/enum-size-variance.rs renamed to src/test/ui/enum-size-variance.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@
77
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
10-
//
10+
11+
// run-pass
12+
// ignore-x86
13+
// ignore-arm
14+
// ignore-emscripten
15+
// ^ ignore 32-bit targets, as the error message is target-dependent. see PR #41968.
16+
1117
#![warn(variant_size_differences)]
1218
#![allow(dead_code)]
1319

src/test/ui/enum-size-variance.stderr

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
warning: enum variant is more than three times larger (32 bytes) than the next largest
2+
--> $DIR/enum-size-variance.rs:32:5
3+
|
4+
32 | L(isize, isize, isize, isize), //~ WARNING three times larger
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
note: lint level defined here
8+
--> $DIR/enum-size-variance.rs:17:9
9+
|
10+
17 | #![warn(variant_size_differences)]
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^
12+

src/test/run-pass/issue-19100.rs renamed to src/test/ui/issue-19100.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// run-pass
12+
1113
#![allow(non_snake_case)]
1214
#![allow(dead_code)]
1315
#![allow(unused_variables)]

src/test/ui/issue-19100.stderr

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
warning[E0170]: pattern binding `Bar` is named the same as one of the variants of the type `Foo`
2+
--> $DIR/issue-19100.rs:27:1
3+
|
4+
27 | Bar if true
5+
| ^^^
6+
|
7+
= help: if you meant to match on a variant, consider making the path in the pattern qualified: `Foo::Bar`
8+
9+
warning[E0170]: pattern binding `Baz` is named the same as one of the variants of the type `Foo`
10+
--> $DIR/issue-19100.rs:32:1
11+
|
12+
32 | Baz if false
13+
| ^^^
14+
|
15+
= help: if you meant to match on a variant, consider making the path in the pattern qualified: `Foo::Baz`
16+

src/test/run-pass/path-lookahead.rs renamed to src/test/ui/path-lookahead.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// run-pass
12+
1113
// Parser test for #37765
1214

1315
fn with_parens<T: ToString>(arg: T) -> String { //~WARN function is never used: `with_parens`

src/test/ui/path-lookahead.stderr

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
warning: unnecessary parentheses around `return` value
2+
--> $DIR/path-lookahead.rs:16:10
3+
|
4+
16 | return (<T as ToString>::to_string(&arg)); //~WARN unnecessary parentheses around `return` value
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: #[warn(unused_parens)] on by default
8+
9+
warning: function is never used: `with_parens`
10+
--> $DIR/path-lookahead.rs:15:1
11+
|
12+
15 | / fn with_parens<T: ToString>(arg: T) -> String { //~WARN function is never used: `with_parens`
13+
16 | | return (<T as ToString>::to_string(&arg)); //~WARN unnecessary parentheses around `return` value
14+
17 | | }
15+
| |_^
16+
|
17+
= note: #[warn(dead_code)] on by default
18+
19+
warning: function is never used: `no_parens`
20+
--> $DIR/path-lookahead.rs:19:1
21+
|
22+
19 | / fn no_parens<T: ToString>(arg: T) -> String { //~WARN function is never used: `no_parens`
23+
20 | | return <T as ToString>::to_string(&arg);
24+
21 | | }
25+
| |_^
26+
|
27+
= note: #[warn(dead_code)] on by default
28+

src/test/run-pass/test-should-panic-attr.rs renamed to src/test/ui/test-should-panic-attr.rs

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// run-pass
1112
// compile-flags: --test
1213

1314
#[test]
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
warning: attribute must be of the form: `#[should_panic]` or `#[should_panic(expected = "error message")]`
2+
--> $DIR/test-should-panic-attr.rs:15:1
3+
|
4+
15 | #[should_panic = "foo"]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: Errors in this attribute were erroneously allowed and will become a hard error in a future release.
8+
9+
warning: argument must be of the form: `expected = "error message"`
10+
--> $DIR/test-should-panic-attr.rs:22:1
11+
|
12+
22 | #[should_panic(expected)]
13+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
14+
|
15+
= note: Errors in this attribute were erroneously allowed and will become a hard error in a future release.
16+
17+
warning: argument must be of the form: `expected = "error message"`
18+
--> $DIR/test-should-panic-attr.rs:29:1
19+
|
20+
29 | #[should_panic(expect)]
21+
| ^^^^^^^^^^^^^^^^^^^^^^^
22+
|
23+
= note: Errors in this attribute were erroneously allowed and will become a hard error in a future release.
24+
25+
warning: argument must be of the form: `expected = "error message"`
26+
--> $DIR/test-should-panic-attr.rs:36:1
27+
|
28+
36 | #[should_panic(expected(foo, bar))]
29+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30+
|
31+
= note: Errors in this attribute were erroneously allowed and will become a hard error in a future release.
32+
33+
warning: argument must be of the form: `expected = "error message"`
34+
--> $DIR/test-should-panic-attr.rs:43:1
35+
|
36+
43 | #[should_panic(expected = "foo", bar)]
37+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38+
|
39+
= note: Errors in this attribute were erroneously allowed and will become a hard error in a future release.
40+

0 commit comments

Comments
 (0)