Skip to content

Commit

Permalink
Make sure all ui/parse tests have -Z parse-only
Browse files Browse the repository at this point in the history
Except those testing parsing during macro expansion
  • Loading branch information
petrochenkov committed Oct 21, 2018
1 parent 64c0efa commit 7977250
Show file tree
Hide file tree
Showing 109 changed files with 151 additions and 119 deletions.
2 changes: 2 additions & 0 deletions src/test/ui/parser/attr-bad-meta-2.rs
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 {}
2 changes: 1 addition & 1 deletion src/test/ui/parser/attr-bad-meta-2.stderr
@@ -1,5 +1,5 @@
error: unexpected token: `]`
--> $DIR/attr-bad-meta-2.rs:11:9
--> $DIR/attr-bad-meta-2.rs:13:9
|
LL | #[path =] //~ ERROR unexpected token: `]`
| ^ unexpected token after this
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/parser/attr-bad-meta-3.rs
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 {}
2 changes: 1 addition & 1 deletion src/test/ui/parser/attr-bad-meta-3.stderr
@@ -1,5 +1,5 @@
error: expected `]`, found `token`
--> $DIR/attr-bad-meta-3.rs:11:10
--> $DIR/attr-bad-meta-3.rs:13:10
|
LL | #[path() token] //~ ERROR expected `]`, found `token`
| ^^^^^ expected `]`
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/parser/attr-bad-meta.rs
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
2 changes: 1 addition & 1 deletion src/test/ui/parser/attr-bad-meta.stderr
@@ -1,5 +1,5 @@
error: expected one of `(`, `::`, `=`, `[`, `]`, or `{`, found `*`
--> $DIR/attr-bad-meta.rs:13:7
--> $DIR/attr-bad-meta.rs:15:7
|
LL | #[path*] //~ ERROR expected one of `(`, `::`, `=`, `[`, `]`, or `{`, found `*`
| ^ expected one of `(`, `::`, `=`, `[`, `]`, or `{` here
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/parser/closure-return-syntax.rs
Expand Up @@ -11,6 +11,8 @@
// Test that we cannot parse a closure with an explicit return type
// unless it uses braces.

// compile-flags: -Z parse-only

fn main() {
let x = || -> i32 22;
//~^ ERROR expected one of `!`, `(`, `+`, `::`, `<`, or `{`, found `22`
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/closure-return-syntax.stderr
@@ -1,5 +1,5 @@
error: expected one of `!`, `(`, `+`, `::`, `<`, or `{`, found `22`
--> $DIR/closure-return-syntax.rs:15:23
--> $DIR/closure-return-syntax.rs:17:23
|
LL | let x = || -> i32 22;
| ^^ expected one of `!`, `(`, `+`, `::`, `<`, or `{` here
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/doc-after-struct-field.rs
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z continue-parse-after-error
// compile-flags: -Z parse-only -Z continue-parse-after-error

struct X {
a: u8 /** document a */,
Expand Down
3 changes: 2 additions & 1 deletion src/test/ui/parser/doc-before-fn-rbrace.rs
Expand Up @@ -8,7 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z continue-parse-after-error
// compile-flags: -Z parse-only -Z continue-parse-after-error

fn main() {
/// document
//~^ ERROR found a documentation comment that doesn't document anything
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/doc-before-fn-rbrace.stderr
@@ -1,5 +1,5 @@
error[E0585]: found a documentation comment that doesn't document anything
--> $DIR/doc-before-fn-rbrace.rs:13:5
--> $DIR/doc-before-fn-rbrace.rs:14:5
|
LL | /// document
| ^^^^^^^^^^^^
Expand Down
3 changes: 2 additions & 1 deletion src/test/ui/parser/doc-before-identifier.rs
Expand Up @@ -8,7 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z continue-parse-after-error
// compile-flags: -Z parse-only -Z continue-parse-after-error

fn /// document
foo() {}
//~^^ ERROR expected identifier, found `/// document`
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/doc-before-identifier.stderr
@@ -1,5 +1,5 @@
error: expected identifier, found `/// document`
--> $DIR/doc-before-identifier.rs:12:4
--> $DIR/doc-before-identifier.rs:13:4
|
LL | fn /// document
| ^^^^^^^^^^^^ expected identifier
Expand Down
3 changes: 2 additions & 1 deletion src/test/ui/parser/doc-before-mod-rbrace.rs
Expand Up @@ -8,7 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z continue-parse-after-error
// compile-flags: -Z parse-only -Z continue-parse-after-error

mod Foo {
/// document
//~^ ERROR expected item after doc comment
Expand Down
9 changes: 2 additions & 7 deletions src/test/ui/parser/doc-before-mod-rbrace.stderr
@@ -1,13 +1,8 @@
error: expected item after doc comment
--> $DIR/doc-before-mod-rbrace.rs:13:5
--> $DIR/doc-before-mod-rbrace.rs:14:5
|
LL | /// document
| ^^^^^^^^^^^^

error[E0601]: `main` function not found in crate `doc_before_mod_rbrace`
|
= note: consider adding a `main` function to `$DIR/doc-before-mod-rbrace.rs`

error: aborting due to 2 previous errors
error: aborting due to previous error

For more information about this error, try `rustc --explain E0601`.
3 changes: 2 additions & 1 deletion src/test/ui/parser/doc-before-struct-rbrace-1.rs
Expand Up @@ -8,7 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z continue-parse-after-error
// compile-flags: -Z parse-only -Z continue-parse-after-error

struct X {
a: u8,
/// document
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/doc-before-struct-rbrace-1.stderr
@@ -1,5 +1,5 @@
error[E0585]: found a documentation comment that doesn't document anything
--> $DIR/doc-before-struct-rbrace-1.rs:14:5
--> $DIR/doc-before-struct-rbrace-1.rs:15:5
|
LL | /// document
| ^^^^^^^^^^^^
Expand Down
3 changes: 2 additions & 1 deletion src/test/ui/parser/doc-before-struct-rbrace-2.rs
Expand Up @@ -8,7 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z continue-parse-after-error
// compile-flags: -Z parse-only -Z continue-parse-after-error

struct X {
a: u8 /// document
//~^ ERROR found a documentation comment that doesn't document anything
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/doc-before-struct-rbrace-2.stderr
@@ -1,5 +1,5 @@
error[E0585]: found a documentation comment that doesn't document anything
--> $DIR/doc-before-struct-rbrace-2.rs:13:11
--> $DIR/doc-before-struct-rbrace-2.rs:14:11
|
LL | a: u8 /// document
| ^^^^^^^^^^^^
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/parser/extern-crate-unexpected-token.rs
Expand Up @@ -8,4 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

extern crte foo; //~ ERROR expected one of `crate`, `fn`, or `{`, found `crte`
2 changes: 1 addition & 1 deletion src/test/ui/parser/extern-crate-unexpected-token.stderr
@@ -1,5 +1,5 @@
error: expected one of `crate`, `fn`, or `{`, found `crte`
--> $DIR/extern-crate-unexpected-token.rs:11:8
--> $DIR/extern-crate-unexpected-token.rs:13:8
|
LL | extern crte foo; //~ ERROR expected one of `crate`, `fn`, or `{`, found `crte`
| ^^^^ expected one of `crate`, `fn`, or `{` here
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/parser/if-in-in.rs
@@ -1,3 +1,5 @@
// compile-flags: -Z parse-only

fn main() {
for i in in 1..2 {
println!("{}", i);
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/if-in-in.stderr
@@ -1,5 +1,5 @@
error: expected iterable, found keyword `in`
--> $DIR/if-in-in.rs:2:14
--> $DIR/if-in-in.rs:4:14
|
LL | for i in in 1..2 {
| ---^^
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/parser/inverted-parameters.rs
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

struct S;

impl S {
Expand Down
12 changes: 6 additions & 6 deletions src/test/ui/parser/inverted-parameters.stderr
@@ -1,5 +1,5 @@
error: expected one of `:` or `@`, found `bar`
--> $DIR/inverted-parameters.rs:14:24
--> $DIR/inverted-parameters.rs:16:24
|
LL | fn foo(&self, &str bar) {}
| -----^^^
Expand All @@ -8,7 +8,7 @@ LL | fn foo(&self, &str bar) {}
| help: declare the type after the parameter binding: `<identifier>: <type>`

error: expected one of `:` or `@`, found `quux`
--> $DIR/inverted-parameters.rs:20:10
--> $DIR/inverted-parameters.rs:22:10
|
LL | fn baz(S quux, xyzzy: i32) {}
| --^^^^
Expand All @@ -17,25 +17,25 @@ LL | fn baz(S quux, xyzzy: i32) {}
| help: declare the type after the parameter binding: `<identifier>: <type>`

error: expected one of `:` or `@`, found `a`
--> $DIR/inverted-parameters.rs:25:12
--> $DIR/inverted-parameters.rs:27:12
|
LL | fn one(i32 a b) {}
| ^ expected one of `:` or `@` here

error: expected `:`, found `(`
--> $DIR/inverted-parameters.rs:28:23
--> $DIR/inverted-parameters.rs:30:23
|
LL | fn pattern((i32, i32) (a, b)) {}
| ^ expected `:`

error: expected one of `:` or `@`, found `)`
--> $DIR/inverted-parameters.rs:31:12
--> $DIR/inverted-parameters.rs:33:12
|
LL | fn fizz(i32) {}
| ^ expected one of `:` or `@` here

error: expected one of `:` or `@`, found `S`
--> $DIR/inverted-parameters.rs:34:23
--> $DIR/inverted-parameters.rs:36:23
|
LL | fn missing_colon(quux S) {}
| -----^
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/parser/issue-10636-2.rs
Expand Up @@ -11,6 +11,8 @@
// FIXME(31528) we emit a bunch of silly errors here due to continuing past the
// first one. This would be easy-ish to address by better recovery in tokenisation.

// compile-flags: -Z parse-only

pub fn trace_option(option: Option<isize>) {
option.map(|some| 42;
//~^ ERROR: expected one of
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/parser/issue-10636-2.stderr
@@ -1,5 +1,5 @@
error: incorrect close delimiter: `}`
--> $DIR/issue-10636-2.rs:18:1
--> $DIR/issue-10636-2.rs:20:1
|
LL | pub fn trace_option(option: Option<isize>) {
| - close delimiter possibly meant for this
Expand All @@ -10,13 +10,13 @@ LL | } //~ ERROR: incorrect close delimiter
| ^ incorrect close delimiter

error: expected one of `)`, `,`, `.`, `?`, or an operator, found `;`
--> $DIR/issue-10636-2.rs:15:25
--> $DIR/issue-10636-2.rs:17:25
|
LL | option.map(|some| 42;
| ^ expected one of `)`, `,`, `.`, `?`, or an operator here

error: expected expression, found `)`
--> $DIR/issue-10636-2.rs:18:1
--> $DIR/issue-10636-2.rs:20:1
|
LL | } //~ ERROR: incorrect close delimiter
| ^ expected expression
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/parser/issue-15980.rs
Expand Up @@ -8,12 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

use std::io;

fn main(){
let x: io::IoResult<()> = Ok(());
//~^ ERROR cannot find type `IoResult` in module `io`
//~| NOTE did you mean `Result`?
match x {
Err(ref e) if e.kind == io::EndOfFile {
//~^ NOTE while parsing this struct
Expand Down
9 changes: 1 addition & 8 deletions src/test/ui/parser/issue-15980.stderr
Expand Up @@ -16,12 +16,5 @@ LL | //~^ NOTE expected one of `.`, `=>`, `?`, or an operator here
LL | _ => {}
| ^ unexpected token

error[E0412]: cannot find type `IoResult` in module `io`
--> $DIR/issue-15980.rs:14:16
|
LL | let x: io::IoResult<()> = Ok(());
| ^^^^^^^^ did you mean `Result`?

error: aborting due to 3 previous errors
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0412`.
2 changes: 2 additions & 0 deletions src/test/ui/parser/issue-22647.rs
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

fn main() {
let caller<F> = |f: F| //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `<`
where F: Fn() -> i32
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/issue-22647.stderr
@@ -1,5 +1,5 @@
error: expected one of `:`, `;`, `=`, or `@`, found `<`
--> $DIR/issue-22647.rs:12:15
--> $DIR/issue-22647.rs:14:15
|
LL | let caller<F> = |f: F| //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `<`
| ^ expected one of `:`, `;`, `=`, or `@` here
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/parser/issue-22712.rs
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

struct Foo<B> {
buffer: B
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/issue-22712.stderr
@@ -1,5 +1,5 @@
error: expected one of `:`, `;`, `=`, or `@`, found `<`
--> $DIR/issue-22712.rs:16:12
--> $DIR/issue-22712.rs:18:12
|
LL | let Foo<Vec<u8>> //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `<`
| ^ expected one of `:`, `;`, `=`, or `@` here
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/parser/issue-24197.rs
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

fn main() {
let buf[0] = 0; //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `[`
}
2 changes: 1 addition & 1 deletion src/test/ui/parser/issue-24197.stderr
@@ -1,5 +1,5 @@
error: expected one of `:`, `;`, `=`, or `@`, found `[`
--> $DIR/issue-24197.rs:12:12
--> $DIR/issue-24197.rs:14:12
|
LL | let buf[0] = 0; //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `[`
| ^ expected one of `:`, `;`, `=`, or `@` here
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/parser/issue-24375.rs
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

static tmp : [&'static str; 2] = ["hello", "he"];

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/issue-24375.stderr
@@ -1,5 +1,5 @@
error: expected one of `=>`, `@`, `if`, or `|`, found `[`
--> $DIR/issue-24375.rs:16:12
--> $DIR/issue-24375.rs:18:12
|
LL | tmp[0] => {} //~ ERROR expected one of `=>`, `@`, `if`, or `|`, found `[`
| ^ expected one of `=>`, `@`, `if`, or `|` here
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/parser/issue-33455.rs
Expand Up @@ -8,4 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

use foo.bar; //~ ERROR expected one of `::`, `;`, or `as`, found `.`
2 changes: 1 addition & 1 deletion src/test/ui/parser/issue-33455.stderr
@@ -1,5 +1,5 @@
error: expected one of `::`, `;`, or `as`, found `.`
--> $DIR/issue-33455.rs:11:8
--> $DIR/issue-33455.rs:13:8
|
LL | use foo.bar; //~ ERROR expected one of `::`, `;`, or `as`, found `.`
| ^ expected one of `::`, `;`, or `as` here
Expand Down
4 changes: 3 additions & 1 deletion src/test/ui/parser/issue-41155.rs
Expand Up @@ -8,7 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

impl S { //~ ERROR cannot find type
// compile-flags: -Z parse-only

impl S {
pub
} //~ ERROR expected one of

Expand Down

0 comments on commit 7977250

Please sign in to comment.