Skip to content

Commit 12a88a6

Browse files
committed
Auto merge of #55236 - petrochenkov:pfail, r=davidtwco
Move parse-fail tests to UI cc #53353 r? @davidtwco
2 parents 0e2f912 + 21d67c4 commit 12a88a6

File tree

587 files changed

+3245
-133
lines changed

Some content is hidden

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

587 files changed

+3245
-133
lines changed

src/bootstrap/builder.rs

-1
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,6 @@ impl<'a> Builder<'a> {
379379
test::Ui,
380380
test::RunPass,
381381
test::CompileFail,
382-
test::ParseFail,
383382
test::RunFail,
384383
test::RunPassValgrind,
385384
test::MirOpt,

src/bootstrap/test.rs

-6
Original file line numberDiff line numberDiff line change
@@ -773,12 +773,6 @@ default_test!(CompileFail {
773773
suite: "compile-fail"
774774
});
775775

776-
default_test!(ParseFail {
777-
path: "src/test/parse-fail",
778-
mode: "parse-fail",
779-
suite: "parse-fail"
780-
});
781-
782776
default_test!(RunFail {
783777
path: "src/test/run-fail",
784778
mode: "run-fail",

src/ci/docker/wasm32-unknown/Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ ENV SCRIPT python2.7 /checkout/x.py test --target $TARGETS \
3636
src/test/ui \
3737
src/test/run-pass \
3838
src/test/compile-fail \
39-
src/test/parse-fail \
4039
src/test/mir-opt \
4140
src/test/codegen-units \
4241
src/libcore \

src/etc/generate-keyword-tests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"""
4545

4646
test_dir = os.path.abspath(
47-
os.path.join(os.path.dirname(__file__), '../test/parse-fail')
47+
os.path.join(os.path.dirname(__file__), '../test/ui/parser')
4848
)
4949

5050
for kw in sys.argv[1:]:

src/libsyntax/parse/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ fn file_to_source_file(sess: &ParseSess, path: &Path, spanopt: Option<Span>)
230230
match sess.source_map().load_file(path) {
231231
Ok(source_file) => source_file,
232232
Err(e) => {
233-
let msg = format!("couldn't read {:?}: {}", path.display(), e);
233+
let msg = format!("couldn't read {}: {}", path.display(), e);
234234
match spanopt {
235235
Some(sp) => sess.span_diagnostic.span_fatal(sp, &msg).raise(),
236236
None => sess.span_diagnostic.fatal(&msg).raise()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
error: this form of character escape may only be used with characters in the range [/x00-/x7f]
2+
--> $DIR/ascii-only-character-escape.rs:14:16
3+
|
4+
LL | let x = "/x80"; //~ ERROR may only be used
5+
| ^^
6+
7+
error: this form of character escape may only be used with characters in the range [/x00-/x7f]
8+
--> $DIR/ascii-only-character-escape.rs:15:16
9+
|
10+
LL | let y = "/xff"; //~ ERROR may only be used
11+
| ^^
12+
13+
error: this form of character escape may only be used with characters in the range [/x00-/x7f]
14+
--> $DIR/ascii-only-character-escape.rs:16:16
15+
|
16+
LL | let z = "/xe2"; //~ ERROR may only be used
17+
| ^^
18+
19+
error: aborting due to 3 previous errors
20+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected one of `.`, `;`, `?`, or `}`, found `[`
2+
--> $DIR/assoc-oddities-1.rs:20:28
3+
|
4+
LL | ..if c { a } else { b }[n]; //~ ERROR expected one of
5+
| ^ expected one of `.`, `;`, `?`, or `}` here
6+
7+
error: aborting due to previous error
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected one of `.`, `;`, `?`, or `}`, found `[`
2+
--> $DIR/assoc-oddities-2.rs:15:29
3+
|
4+
LL | x..if c { a } else { b }[n]; //~ ERROR expected one of
5+
| ^ expected one of `.`, `;`, `?`, or `}` here
6+
7+
error: aborting due to previous error
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: expected identifier, found keyword `for`
2+
--> $DIR/associated-types-project-from-hrtb-explicit.rs:22:21
3+
|
4+
LL | fn foo2<I>(x: <I as for<'x> Foo<&'x isize>>::A)
5+
| ^^^ expected identifier, found keyword
6+
7+
error: expected one of `::` or `>`, found `Foo`
8+
--> $DIR/associated-types-project-from-hrtb-explicit.rs:22:29
9+
|
10+
LL | fn foo2<I>(x: <I as for<'x> Foo<&'x isize>>::A)
11+
| ^^^ expected one of `::` or `>` here
12+
13+
error: aborting due to 2 previous errors
14+

src/test/parse-fail/attr-bad-meta-2.rs renamed to src/test/ui/parser/attr-bad-meta-2.rs

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

11+
// compile-flags: -Z parse-only
12+
1113
#[path =] //~ ERROR unexpected token: `]`
1214
mod m {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: unexpected token: `]`
2+
--> $DIR/attr-bad-meta-2.rs:13:9
3+
|
4+
LL | #[path =] //~ ERROR unexpected token: `]`
5+
| ^ unexpected token after this
6+
7+
error: aborting due to previous error
8+

src/test/parse-fail/attr-bad-meta-3.rs renamed to src/test/ui/parser/attr-bad-meta-3.rs

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

11+
// compile-flags: -Z parse-only
12+
1113
#[path() token] //~ ERROR expected `]`, found `token`
1214
mod m {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected `]`, found `token`
2+
--> $DIR/attr-bad-meta-3.rs:13:10
3+
|
4+
LL | #[path() token] //~ ERROR expected `]`, found `token`
5+
| ^^^^^ expected `]`
6+
7+
error: aborting due to previous error
8+

src/test/parse-fail/attr-bad-meta.rs renamed to src/test/ui/parser/attr-bad-meta.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+
// compile-flags: -Z parse-only
12+
1113
#![feature(unrestricted_attribute_tokens)]
1214

1315
#[path*] //~ ERROR expected one of `(`, `::`, `=`, `[`, `]`, or `{`, found `*`
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected one of `(`, `::`, `=`, `[`, `]`, or `{`, found `*`
2+
--> $DIR/attr-bad-meta.rs:15:7
3+
|
4+
LL | #[path*] //~ ERROR expected one of `(`, `::`, `=`, `[`, `]`, or `{`, found `*`
5+
| ^ expected one of `(`, `::`, `=`, `[`, `]`, or `{` here
6+
7+
error: aborting due to previous error
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected item after attributes
2+
--> $DIR/attr-before-eof.rs:13:16
3+
|
4+
LL | #[derive(Debug)] //~ERROR expected item after attributes
5+
| ^
6+
7+
error: aborting due to previous error
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected statement after outer attribute
2+
--> $DIR/attr-dangling-in-fn.rs:17:1
3+
|
4+
LL | }
5+
| ^
6+
7+
error: aborting due to previous error
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected item after attributes
2+
--> $DIR/attr-dangling-in-mod.rs:18:14
3+
|
4+
LL | #[foo = "bar"]
5+
| ^
6+
7+
error: aborting due to previous error
8+
File renamed without changes.

src/test/ui/parser/attr.stderr

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: an inner attribute is not permitted in this context
2+
--> $DIR/attr.rs:17:3
3+
|
4+
LL | #![lang(foo)] //~ ERROR an inner attribute is not permitted in this context
5+
| ^
6+
|
7+
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them.
8+
9+
error: aborting due to previous error
10+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected item after attributes
2+
--> $DIR/attrs-after-extern-mod.rs:22:19
3+
|
4+
LL | #[cfg(stage37)] //~ ERROR expected item after attributes
5+
| ^
6+
7+
error: aborting due to previous error
8+

src/test/ui/parser/bad-char-literals.stderr

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
error: character constant must be escaped: '
2+
--> $DIR/bad-char-literals.rs:17:6
3+
|
4+
LL | ''';
5+
| ^
6+
7+
error: character constant must be escaped: /n
8+
--> $DIR/bad-char-literals.rs:21:6
9+
|
10+
LL | '
11+
| ______^
12+
LL | | ';
13+
| |_
14+
15+
error: character constant must be escaped: /r
16+
--> $DIR/bad-char-literals.rs:26:6
17+
|
18+
LL | ''; //~ ERROR: character constant must be escaped: /r
19+
| ^
20+
21+
error: character constant must be escaped: /t
22+
--> $DIR/bad-char-literals.rs:29:6
23+
|
24+
LL | ' ';
25+
| ^^^^
26+
27+
error: aborting due to 4 previous errors
28+
+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
error: ABI spec with a suffix is invalid
2+
--> $DIR/bad-lit-suffixes.rs:15:5
3+
|
4+
LL | "C"suffix //~ ERROR ABI spec with a suffix is invalid
5+
| ^^^^^^^^^
6+
7+
error: ABI spec with a suffix is invalid
8+
--> $DIR/bad-lit-suffixes.rs:19:5
9+
|
10+
LL | "C"suffix //~ ERROR ABI spec with a suffix is invalid
11+
| ^^^^^^^^^
12+
13+
error: string literal with a suffix is invalid
14+
--> $DIR/bad-lit-suffixes.rs:23:5
15+
|
16+
LL | ""suffix; //~ ERROR string literal with a suffix is invalid
17+
| ^^^^^^^^
18+
19+
error: byte string literal with a suffix is invalid
20+
--> $DIR/bad-lit-suffixes.rs:24:5
21+
|
22+
LL | b""suffix; //~ ERROR byte string literal with a suffix is invalid
23+
| ^^^^^^^^^
24+
25+
error: string literal with a suffix is invalid
26+
--> $DIR/bad-lit-suffixes.rs:25:5
27+
|
28+
LL | r#""#suffix; //~ ERROR string literal with a suffix is invalid
29+
| ^^^^^^^^^^^
30+
31+
error: byte string literal with a suffix is invalid
32+
--> $DIR/bad-lit-suffixes.rs:26:5
33+
|
34+
LL | br#""#suffix; //~ ERROR byte string literal with a suffix is invalid
35+
| ^^^^^^^^^^^^
36+
37+
error: char literal with a suffix is invalid
38+
--> $DIR/bad-lit-suffixes.rs:27:5
39+
|
40+
LL | 'a'suffix; //~ ERROR char literal with a suffix is invalid
41+
| ^^^^^^^^^
42+
43+
error: byte literal with a suffix is invalid
44+
--> $DIR/bad-lit-suffixes.rs:28:5
45+
|
46+
LL | b'a'suffix; //~ ERROR byte literal with a suffix is invalid
47+
| ^^^^^^^^^^
48+
49+
error: invalid width `1024` for integer literal
50+
--> $DIR/bad-lit-suffixes.rs:30:5
51+
|
52+
LL | 1234u1024; //~ ERROR invalid width `1024` for integer literal
53+
| ^^^^^^^^^
54+
|
55+
= help: valid widths are 8, 16, 32, 64 and 128
56+
57+
error: invalid width `1024` for integer literal
58+
--> $DIR/bad-lit-suffixes.rs:31:5
59+
|
60+
LL | 1234i1024; //~ ERROR invalid width `1024` for integer literal
61+
| ^^^^^^^^^
62+
|
63+
= help: valid widths are 8, 16, 32, 64 and 128
64+
65+
error: invalid width `1024` for float literal
66+
--> $DIR/bad-lit-suffixes.rs:32:5
67+
|
68+
LL | 1234f1024; //~ ERROR invalid width `1024` for float literal
69+
| ^^^^^^^^^
70+
|
71+
= help: valid widths are 32 and 64
72+
73+
error: invalid width `1024` for float literal
74+
--> $DIR/bad-lit-suffixes.rs:33:5
75+
|
76+
LL | 1234.5f1024; //~ ERROR invalid width `1024` for float literal
77+
| ^^^^^^^^^^^
78+
|
79+
= help: valid widths are 32 and 64
80+
81+
error: invalid suffix `suffix` for numeric literal
82+
--> $DIR/bad-lit-suffixes.rs:35:5
83+
|
84+
LL | 1234suffix; //~ ERROR invalid suffix `suffix` for numeric literal
85+
| ^^^^^^^^^^
86+
|
87+
= help: the suffix must be one of the integral types (`u32`, `isize`, etc)
88+
89+
error: invalid suffix `suffix` for numeric literal
90+
--> $DIR/bad-lit-suffixes.rs:36:5
91+
|
92+
LL | 0b101suffix; //~ ERROR invalid suffix `suffix` for numeric literal
93+
| ^^^^^^^^^^^
94+
|
95+
= help: the suffix must be one of the integral types (`u32`, `isize`, etc)
96+
97+
error: invalid suffix `suffix` for float literal
98+
--> $DIR/bad-lit-suffixes.rs:37:5
99+
|
100+
LL | 1.0suffix; //~ ERROR invalid suffix `suffix` for float literal
101+
| ^^^^^^^^^
102+
|
103+
= help: valid suffixes are `f32` and `f64`
104+
105+
error: invalid suffix `suffix` for float literal
106+
--> $DIR/bad-lit-suffixes.rs:38:5
107+
|
108+
LL | 1.0e10suffix; //~ ERROR invalid suffix `suffix` for float literal
109+
| ^^^^^^^^^^^^
110+
|
111+
= help: valid suffixes are `f32` and `f64`
112+
113+
error: aborting due to 16 previous errors
114+
File renamed without changes.

src/test/ui/parser/bad-match.stderr

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected one of `:`, `;`, `=`, or `@`, found `x`
2+
--> $DIR/bad-match.rs:16:13
3+
|
4+
LL | let isize x = 5;
5+
| ^ expected one of `:`, `;`, `=`, or `@` here
6+
7+
error: aborting due to previous error
8+
File renamed without changes.

src/test/ui/parser/bad-name.stderr

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected one of `:`, `;`, `=`, or `@`, found `.`
2+
--> $DIR/bad-name.rs:16:8
3+
|
4+
LL | let x.y::<isize>.z foo;
5+
| ^ expected one of `:`, `;`, `=`, or `@` here
6+
7+
error: aborting due to previous error
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected mut or const in raw pointer type (use `*mut T` or `*const T` as appropriate)
2+
--> $DIR/bad-pointer-type.rs:13:11
3+
|
4+
LL | fn foo(_: *()) {
5+
| ^
6+
7+
error: aborting due to previous error
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected identifier, found keyword `false`
2+
--> $DIR/bad-value-ident-false.rs:13:4
3+
|
4+
LL | fn false() { } //~ ERROR expected identifier, found keyword `false`
5+
| ^^^^^ expected identifier, found keyword
6+
7+
error: aborting due to previous error
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected identifier, found keyword `true`
2+
--> $DIR/bad-value-ident-true.rs:13:4
3+
|
4+
LL | fn true() { } //~ ERROR expected identifier, found keyword `true`
5+
| ^^^^ expected identifier, found keyword
6+
7+
error: aborting due to previous error
8+
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `3`
2+
--> $DIR/better-expected.rs:14:19
3+
|
4+
LL | let x: [isize 3]; //~ ERROR expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `3`
5+
| - ^ expected one of 7 possible tokens here
6+
| |
7+
| while parsing the type for `x`
8+
9+
error: aborting due to previous error
10+

0 commit comments

Comments
 (0)