about summary refs log tree commit diff
path: root/src/test/parse-fail
diff options
context:
space:
mode:
authorNick Cameron <ncameron@mozilla.com>2016-02-01 08:39:50 +1300
committerNick Cameron <ncameron@mozilla.com>2016-02-15 09:30:23 +1300
commitffd2a0b9d78191b8a3d97f687077852d15c9b7aa (patch)
treee42abe4c33ac32d668304dff9a024d2d0ad8aa5c /src/test/parse-fail
parent0ef9c5f5853ce35db142e4e2793984148df3d5f8 (diff)
downloadrust-ffd2a0b9d78191b8a3d97f687077852d15c9b7aa.tar.gz
rust-ffd2a0b9d78191b8a3d97f687077852d15c9b7aa.zip
Add some simple error recovery to the parser and fix tests
Some tests just add the extra errors, others I fix by doing some simple error recovery. I've tried to avoid doing too much in the hope of doing something more principled later.

In general error messages are getting worse at this stage, but I think in the long run they will get better.
Diffstat (limited to 'src/test/parse-fail')
-rw-r--r--src/test/parse-fail/issue-14303-path.rs1
-rw-r--r--src/test/parse-fail/issue-2354.rs4
-rw-r--r--src/test/parse-fail/pat-lt-bracket-6.rs1
-rw-r--r--src/test/parse-fail/pat-lt-bracket-7.rs3
-rw-r--r--src/test/parse-fail/variadic-ffi-1.rs18
5 files changed, 6 insertions, 21 deletions
diff --git a/src/test/parse-fail/issue-14303-path.rs b/src/test/parse-fail/issue-14303-path.rs
index f0d1feffec8..7c30b5f2629 100644
--- a/src/test/parse-fail/issue-14303-path.rs
+++ b/src/test/parse-fail/issue-14303-path.rs
@@ -12,3 +12,4 @@
 
 fn bar<'a, T>(x: mymodule::X<'a, T, 'b, 'c>) {}
 //~^ ERROR lifetime parameters must be declared prior to type parameters
+//~^^ ERROR unexpected token
diff --git a/src/test/parse-fail/issue-2354.rs b/src/test/parse-fail/issue-2354.rs
index 0b380d6ae88..2e799a72c81 100644
--- a/src/test/parse-fail/issue-2354.rs
+++ b/src/test/parse-fail/issue-2354.rs
@@ -12,8 +12,8 @@
 
 fn foo() { //~ HELP did you mean to close this delimiter?
   match Some(x) {
-      Some(y) { panic!(); }
-      None    { panic!(); }
+      Some(y) => { panic!(); }
+      None => { panic!(); }
 }
 
 fn bar() {
diff --git a/src/test/parse-fail/pat-lt-bracket-6.rs b/src/test/parse-fail/pat-lt-bracket-6.rs
index 72fdae82260..bc27aedb627 100644
--- a/src/test/parse-fail/pat-lt-bracket-6.rs
+++ b/src/test/parse-fail/pat-lt-bracket-6.rs
@@ -10,4 +10,5 @@
 
 fn main() {
     let Test(&desc[..]) = x; //~ error: expected one of `,` or `@`, found `[`
+    //~^ ERROR expected one of `:`, `;`, or `=`, found `..`
 }
diff --git a/src/test/parse-fail/pat-lt-bracket-7.rs b/src/test/parse-fail/pat-lt-bracket-7.rs
index c7731d156ad..3e9478da44d 100644
--- a/src/test/parse-fail/pat-lt-bracket-7.rs
+++ b/src/test/parse-fail/pat-lt-bracket-7.rs
@@ -9,5 +9,6 @@
 // except according to those terms.
 
 fn main() {
-    for thing(x[]) {} //~ error: expected one of `,` or `@`, found `[`
+    for thing(x[]) in foo {} //~ error: expected one of `,` or `@`, found `[`
+    //~^ ERROR: expected `in`, found `]`
 }
diff --git a/src/test/parse-fail/variadic-ffi-1.rs b/src/test/parse-fail/variadic-ffi-1.rs
deleted file mode 100644
index 63a36e98439..00000000000
--- a/src/test/parse-fail/variadic-ffi-1.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// compile-flags: -Z parse-only
-
-extern {
-    fn printf(...); //~ ERROR: variadic function must be declared with at least one named argument
-    fn printf(..., foo: isize); //~ ERROR: `...` must be last in argument list for variadic function
-}
-
-fn main() {}