Skip to content

Commit

Permalink
fix compile-fail and parse-fail tests by blindly opting back into
Browse files Browse the repository at this point in the history
parser recovery (so that expected errors match up)

I'm opting into parser recovery in all these cases out of expediency,
not because the error messages you get with recovery enabled are
actually all that usable in all cases listed.
  • Loading branch information
pnkfelix committed Mar 30, 2016
1 parent 2646663 commit e1d8ad3
Show file tree
Hide file tree
Showing 21 changed files with 31 additions and 11 deletions.
2 changes: 2 additions & 0 deletions src/test/compile-fail/issue-12560-2.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 continue-parse-after-error

// For style and consistency reasons, non-parametrized enum variants must
// be used simply as `ident` instead of `ident ()`.
// This test-case covers enum matching.
Expand Down
2 changes: 2 additions & 0 deletions src/test/compile-fail/issue-28433.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 continue-parse-after-error

enum bird {
pub duck,
//~^ ERROR: expected identifier, found keyword `pub`
Expand Down
2 changes: 2 additions & 0 deletions src/test/compile-fail/issue-30715.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 continue-parse-after-error

macro_rules! parallel {
(
// If future has `pred`/`moelarry` fragments (where "pred" is
Expand Down
2 changes: 2 additions & 0 deletions src/test/compile-fail/macro-incomplete-parse.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 continue-parse-after-error

macro_rules! ignored_item {
() => {
fn foo() {}
Expand Down
2 changes: 2 additions & 0 deletions src/test/compile-fail/parse-error-correct.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 continue-parse-after-error

// Test that the parser is error correcting missing idents. Despite a parsing
// error (or two), we still run type checking (and don't get extra errors there).

Expand Down
2 changes: 2 additions & 0 deletions src/test/compile-fail/parser-recovery-1.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 continue-parse-after-error

// Test that we can recover from missing braces in the parser.

trait Foo {
Expand Down
2 changes: 2 additions & 0 deletions src/test/compile-fail/parser-recovery-2.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 continue-parse-after-error

// Test that we can recover from mismatched braces in the parser.

trait Foo {
Expand Down
2 changes: 2 additions & 0 deletions src/test/compile-fail/self_type_keyword.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 continue-parse-after-error

struct Self;
//~^ ERROR expected identifier, found keyword `Self`

Expand Down
2 changes: 1 addition & 1 deletion src/test/parse-fail/ascii-only-character-escape.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 parse-only
// compile-flags: -Z parse-only -Z continue-parse-after-error

fn main() {
let x = "\x80"; //~ ERROR may only be used
Expand Down
2 changes: 1 addition & 1 deletion src/test/parse-fail/bad-char-literals.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 parse-only
// compile-flags: -Z parse-only -Z continue-parse-after-error

// ignore-tidy-cr
// ignore-tidy-tab
Expand Down
2 changes: 1 addition & 1 deletion src/test/parse-fail/bad-lit-suffixes.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 parse-only
// compile-flags: -Z parse-only -Z continue-parse-after-error


extern
Expand Down
2 changes: 1 addition & 1 deletion src/test/parse-fail/byte-literals.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 parse-only
// compile-flags: -Z parse-only -Z continue-parse-after-error


// ignore-tidy-tab
Expand Down
2 changes: 1 addition & 1 deletion src/test/parse-fail/byte-string-literals.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 parse-only
// compile-flags: -Z parse-only -Z continue-parse-after-error


// ignore-tidy-tab
Expand Down
2 changes: 1 addition & 1 deletion src/test/parse-fail/issue-10412.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 parse-only
// compile-flags: -Z parse-only -Z continue-parse-after-error


trait Serializable<'self, T> { //~ ERROR no longer a special lifetime
Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/issue-23620-invalid-escapes.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 -Z continue-parse-after-error

fn main() {
let _ = b"\u{a66e}";
//~^ ERROR unicode escape sequences cannot be used as a byte or in a byte string
Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/lex-bad-binary-literal.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 -Z continue-parse-after-error

fn main() {
0b121; //~ ERROR invalid digit for a base 2 literal
0b10_10301; //~ ERROR invalid digit for a base 2 literal
Expand Down
2 changes: 1 addition & 1 deletion src/test/parse-fail/lex-bad-char-literals-1.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 parse-only
// compile-flags: -Z parse-only -Z continue-parse-after-error
static c3: char =
'\x1' //~ ERROR: numeric character escape is too short
;
Expand Down
2 changes: 1 addition & 1 deletion src/test/parse-fail/lex-bad-numeric-literals.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 parse-only
// compile-flags: -Z parse-only -Z continue-parse-after-error

fn main() {
0o1.0; //~ ERROR: octal float literal is not supported
Expand Down
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

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

// ignore-tidy-cr

Expand Down
2 changes: 1 addition & 1 deletion src/test/parse-fail/new-unicode-escapes-4.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 parse-only
// compile-flags: -Z parse-only -Z continue-parse-after-error

pub fn main() {
let s = "\u{lol}";
Expand Down
2 changes: 1 addition & 1 deletion src/test/parse-fail/no-unsafe-self.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 parse-only
// compile-flags: -Z parse-only -Z continue-parse-after-error

trait A {
fn foo(*mut self); //~ ERROR cannot pass self by raw pointer
Expand Down

0 comments on commit e1d8ad3

Please sign in to comment.