Skip to content

Commit

Permalink
Auto merge of #55236 - petrochenkov:pfail, r=davidtwco
Browse files Browse the repository at this point in the history
Move parse-fail tests to UI

cc #53353

r? @davidtwco
  • Loading branch information
bors committed Oct 21, 2018
2 parents 0e2f912 + 21d67c4 commit 12a88a6
Show file tree
Hide file tree
Showing 587 changed files with 3,245 additions and 133 deletions.
1 change: 0 additions & 1 deletion src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ impl<'a> Builder<'a> {
test::Ui,
test::RunPass,
test::CompileFail,
test::ParseFail,
test::RunFail,
test::RunPassValgrind,
test::MirOpt,
Expand Down
6 changes: 0 additions & 6 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -773,12 +773,6 @@ default_test!(CompileFail {
suite: "compile-fail"
});

default_test!(ParseFail {
path: "src/test/parse-fail",
mode: "parse-fail",
suite: "parse-fail"
});

default_test!(RunFail {
path: "src/test/run-fail",
mode: "run-fail",
Expand Down
1 change: 0 additions & 1 deletion src/ci/docker/wasm32-unknown/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ ENV SCRIPT python2.7 /checkout/x.py test --target $TARGETS \
src/test/ui \
src/test/run-pass \
src/test/compile-fail \
src/test/parse-fail \
src/test/mir-opt \
src/test/codegen-units \
src/libcore \
2 changes: 1 addition & 1 deletion src/etc/generate-keyword-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"""

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

for kw in sys.argv[1:]:
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/parse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ fn file_to_source_file(sess: &ParseSess, path: &Path, spanopt: Option<Span>)
match sess.source_map().load_file(path) {
Ok(source_file) => source_file,
Err(e) => {
let msg = format!("couldn't read {:?}: {}", path.display(), e);
let msg = format!("couldn't read {}: {}", path.display(), e);
match spanopt {
Some(sp) => sess.span_diagnostic.span_fatal(sp, &msg).raise(),
None => sess.span_diagnostic.fatal(&msg).raise()
Expand Down
20 changes: 20 additions & 0 deletions src/test/ui/parser/ascii-only-character-escape.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
error: this form of character escape may only be used with characters in the range [/x00-/x7f]
--> $DIR/ascii-only-character-escape.rs:14:16
|
LL | let x = "/x80"; //~ ERROR may only be used
| ^^

error: this form of character escape may only be used with characters in the range [/x00-/x7f]
--> $DIR/ascii-only-character-escape.rs:15:16
|
LL | let y = "/xff"; //~ ERROR may only be used
| ^^

error: this form of character escape may only be used with characters in the range [/x00-/x7f]
--> $DIR/ascii-only-character-escape.rs:16:16
|
LL | let z = "/xe2"; //~ ERROR may only be used
| ^^

error: aborting due to 3 previous errors

File renamed without changes.
8 changes: 8 additions & 0 deletions src/test/ui/parser/assoc-oddities-1.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: expected one of `.`, `;`, `?`, or `}`, found `[`
--> $DIR/assoc-oddities-1.rs:20:28
|
LL | ..if c { a } else { b }[n]; //~ ERROR expected one of
| ^ expected one of `.`, `;`, `?`, or `}` here

error: aborting due to previous error

File renamed without changes.
8 changes: 8 additions & 0 deletions src/test/ui/parser/assoc-oddities-2.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: expected one of `.`, `;`, `?`, or `}`, found `[`
--> $DIR/assoc-oddities-2.rs:15:29
|
LL | x..if c { a } else { b }[n]; //~ ERROR expected one of
| ^ expected one of `.`, `;`, `?`, or `}` here

error: aborting due to previous error

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
error: expected identifier, found keyword `for`
--> $DIR/associated-types-project-from-hrtb-explicit.rs:22:21
|
LL | fn foo2<I>(x: <I as for<'x> Foo<&'x isize>>::A)
| ^^^ expected identifier, found keyword

error: expected one of `::` or `>`, found `Foo`
--> $DIR/associated-types-project-from-hrtb-explicit.rs:22:29
|
LL | fn foo2<I>(x: <I as for<'x> Foo<&'x isize>>::A)
| ^^^ expected one of `::` or `>` here

error: aborting due to 2 previous errors

Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

#[path =] //~ ERROR unexpected token: `]`
mod m {}
8 changes: 8 additions & 0 deletions src/test/ui/parser/attr-bad-meta-2.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: unexpected token: `]`
--> $DIR/attr-bad-meta-2.rs:13:9
|
LL | #[path =] //~ ERROR unexpected token: `]`
| ^ unexpected token after this

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

#[path() token] //~ ERROR expected `]`, found `token`
mod m {}
8 changes: 8 additions & 0 deletions src/test/ui/parser/attr-bad-meta-3.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: expected `]`, found `token`
--> $DIR/attr-bad-meta-3.rs:13:10
|
LL | #[path() token] //~ ERROR expected `]`, found `token`
| ^^^^^ expected `]`

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

#![feature(unrestricted_attribute_tokens)]

#[path*] //~ ERROR expected one of `(`, `::`, `=`, `[`, `]`, or `{`, found `*`
Expand Down
8 changes: 8 additions & 0 deletions src/test/ui/parser/attr-bad-meta.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: expected one of `(`, `::`, `=`, `[`, `]`, or `{`, found `*`
--> $DIR/attr-bad-meta.rs:15:7
|
LL | #[path*] //~ ERROR expected one of `(`, `::`, `=`, `[`, `]`, or `{`, found `*`
| ^ expected one of `(`, `::`, `=`, `[`, `]`, or `{` here

error: aborting due to previous error

File renamed without changes.
8 changes: 8 additions & 0 deletions src/test/ui/parser/attr-before-eof.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: expected item after attributes
--> $DIR/attr-before-eof.rs:13:16
|
LL | #[derive(Debug)] //~ERROR expected item after attributes
| ^

error: aborting due to previous error

File renamed without changes.
8 changes: 8 additions & 0 deletions src/test/ui/parser/attr-dangling-in-fn.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: expected statement after outer attribute
--> $DIR/attr-dangling-in-fn.rs:17:1
|
LL | }
| ^

error: aborting due to previous error

File renamed without changes.
8 changes: 8 additions & 0 deletions src/test/ui/parser/attr-dangling-in-mod.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: expected item after attributes
--> $DIR/attr-dangling-in-mod.rs:18:14
|
LL | #[foo = "bar"]
| ^

error: aborting due to previous error

File renamed without changes.
10 changes: 10 additions & 0 deletions src/test/ui/parser/attr.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
error: an inner attribute is not permitted in this context
--> $DIR/attr.rs:17:3
|
LL | #![lang(foo)] //~ ERROR an inner attribute is not permitted in this context
| ^
|
= 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.

error: aborting due to previous error

8 changes: 8 additions & 0 deletions src/test/ui/parser/attrs-after-extern-mod.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: expected item after attributes
--> $DIR/attrs-after-extern-mod.rs:22:19
|
LL | #[cfg(stage37)] //~ ERROR expected item after attributes
| ^

error: aborting due to previous error

File renamed without changes.
28 changes: 28 additions & 0 deletions src/test/ui/parser/bad-char-literals.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
error: character constant must be escaped: '
--> $DIR/bad-char-literals.rs:17:6
|
LL | ''';
| ^

error: character constant must be escaped: /n
--> $DIR/bad-char-literals.rs:21:6
|
LL | '
| ______^
LL | | ';
| |_

error: character constant must be escaped: /r
--> $DIR/bad-char-literals.rs:26:6
|
LL | ''; //~ ERROR: character constant must be escaped: /r
| ^

error: character constant must be escaped: /t
--> $DIR/bad-char-literals.rs:29:6
|
LL | ' ';
| ^^^^

error: aborting due to 4 previous errors

Expand Down
File renamed without changes.
114 changes: 114 additions & 0 deletions src/test/ui/parser/bad-lit-suffixes.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
error: ABI spec with a suffix is invalid
--> $DIR/bad-lit-suffixes.rs:15:5
|
LL | "C"suffix //~ ERROR ABI spec with a suffix is invalid
| ^^^^^^^^^

error: ABI spec with a suffix is invalid
--> $DIR/bad-lit-suffixes.rs:19:5
|
LL | "C"suffix //~ ERROR ABI spec with a suffix is invalid
| ^^^^^^^^^

error: string literal with a suffix is invalid
--> $DIR/bad-lit-suffixes.rs:23:5
|
LL | ""suffix; //~ ERROR string literal with a suffix is invalid
| ^^^^^^^^

error: byte string literal with a suffix is invalid
--> $DIR/bad-lit-suffixes.rs:24:5
|
LL | b""suffix; //~ ERROR byte string literal with a suffix is invalid
| ^^^^^^^^^

error: string literal with a suffix is invalid
--> $DIR/bad-lit-suffixes.rs:25:5
|
LL | r#""#suffix; //~ ERROR string literal with a suffix is invalid
| ^^^^^^^^^^^

error: byte string literal with a suffix is invalid
--> $DIR/bad-lit-suffixes.rs:26:5
|
LL | br#""#suffix; //~ ERROR byte string literal with a suffix is invalid
| ^^^^^^^^^^^^

error: char literal with a suffix is invalid
--> $DIR/bad-lit-suffixes.rs:27:5
|
LL | 'a'suffix; //~ ERROR char literal with a suffix is invalid
| ^^^^^^^^^

error: byte literal with a suffix is invalid
--> $DIR/bad-lit-suffixes.rs:28:5
|
LL | b'a'suffix; //~ ERROR byte literal with a suffix is invalid
| ^^^^^^^^^^

error: invalid width `1024` for integer literal
--> $DIR/bad-lit-suffixes.rs:30:5
|
LL | 1234u1024; //~ ERROR invalid width `1024` for integer literal
| ^^^^^^^^^
|
= help: valid widths are 8, 16, 32, 64 and 128

error: invalid width `1024` for integer literal
--> $DIR/bad-lit-suffixes.rs:31:5
|
LL | 1234i1024; //~ ERROR invalid width `1024` for integer literal
| ^^^^^^^^^
|
= help: valid widths are 8, 16, 32, 64 and 128

error: invalid width `1024` for float literal
--> $DIR/bad-lit-suffixes.rs:32:5
|
LL | 1234f1024; //~ ERROR invalid width `1024` for float literal
| ^^^^^^^^^
|
= help: valid widths are 32 and 64

error: invalid width `1024` for float literal
--> $DIR/bad-lit-suffixes.rs:33:5
|
LL | 1234.5f1024; //~ ERROR invalid width `1024` for float literal
| ^^^^^^^^^^^
|
= help: valid widths are 32 and 64

error: invalid suffix `suffix` for numeric literal
--> $DIR/bad-lit-suffixes.rs:35:5
|
LL | 1234suffix; //~ ERROR invalid suffix `suffix` for numeric literal
| ^^^^^^^^^^
|
= help: the suffix must be one of the integral types (`u32`, `isize`, etc)

error: invalid suffix `suffix` for numeric literal
--> $DIR/bad-lit-suffixes.rs:36:5
|
LL | 0b101suffix; //~ ERROR invalid suffix `suffix` for numeric literal
| ^^^^^^^^^^^
|
= help: the suffix must be one of the integral types (`u32`, `isize`, etc)

error: invalid suffix `suffix` for float literal
--> $DIR/bad-lit-suffixes.rs:37:5
|
LL | 1.0suffix; //~ ERROR invalid suffix `suffix` for float literal
| ^^^^^^^^^
|
= help: valid suffixes are `f32` and `f64`

error: invalid suffix `suffix` for float literal
--> $DIR/bad-lit-suffixes.rs:38:5
|
LL | 1.0e10suffix; //~ ERROR invalid suffix `suffix` for float literal
| ^^^^^^^^^^^^
|
= help: valid suffixes are `f32` and `f64`

error: aborting due to 16 previous errors

File renamed without changes.
8 changes: 8 additions & 0 deletions src/test/ui/parser/bad-match.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: expected one of `:`, `;`, `=`, or `@`, found `x`
--> $DIR/bad-match.rs:16:13
|
LL | let isize x = 5;
| ^ expected one of `:`, `;`, `=`, or `@` here

error: aborting due to previous error

File renamed without changes.
8 changes: 8 additions & 0 deletions src/test/ui/parser/bad-name.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: expected one of `:`, `;`, `=`, or `@`, found `.`
--> $DIR/bad-name.rs:16:8
|
LL | let x.y::<isize>.z foo;
| ^ expected one of `:`, `;`, `=`, or `@` here

error: aborting due to previous error

File renamed without changes.
8 changes: 8 additions & 0 deletions src/test/ui/parser/bad-pointer-type.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: expected mut or const in raw pointer type (use `*mut T` or `*const T` as appropriate)
--> $DIR/bad-pointer-type.rs:13:11
|
LL | fn foo(_: *()) {
| ^

error: aborting due to previous error

File renamed without changes.
8 changes: 8 additions & 0 deletions src/test/ui/parser/bad-value-ident-false.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: expected identifier, found keyword `false`
--> $DIR/bad-value-ident-false.rs:13:4
|
LL | fn false() { } //~ ERROR expected identifier, found keyword `false`
| ^^^^^ expected identifier, found keyword

error: aborting due to previous error

File renamed without changes.
8 changes: 8 additions & 0 deletions src/test/ui/parser/bad-value-ident-true.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: expected identifier, found keyword `true`
--> $DIR/bad-value-ident-true.rs:13:4
|
LL | fn true() { } //~ ERROR expected identifier, found keyword `true`
| ^^^^ expected identifier, found keyword

error: aborting due to previous error

File renamed without changes.
10 changes: 10 additions & 0 deletions src/test/ui/parser/better-expected.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `3`
--> $DIR/better-expected.rs:14:19
|
LL | let x: [isize 3]; //~ ERROR expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `3`
| - ^ expected one of 7 possible tokens here
| |
| while parsing the type for `x`

error: aborting due to previous error

Loading

0 comments on commit 12a88a6

Please sign in to comment.