about summary refs log tree commit diff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-04-24 13:47:22 -0700
committerbors <bors@rust-lang.org>2016-04-24 13:47:22 -0700
commit19304837c86cc406ee042c99e12fa34debae4e8a (patch)
tree180cf9b6c1b7e850bf19c7101e112729ad381b6e /src/test/compile-fail
parent91aea5cf87953788477ccaa3a37c3f2c855e7a0a (diff)
parenta31658de51444d1b5193ac203a1bd7ace5621f93 (diff)
downloadrust-19304837c86cc406ee042c99e12fa34debae4e8a.tar.gz
rust-19304837c86cc406ee042c99e12fa34debae4e8a.zip
Auto merge of #33179 - Manishearth:breaking-batch, r=Manishearth
Batch up breaking libsyntax changes

Contains:

 - #33125
 - #33041
 - #33157

cc https://github.com/rust-lang/rust/issues/31645
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/fail-simple.rs4
-rw-r--r--src/test/compile-fail/import-ty-params.rs2
-rw-r--r--src/test/compile-fail/issue-10636-2.rs2
-rw-r--r--src/test/compile-fail/issue-31804.rs2
-rw-r--r--src/test/compile-fail/keyword-false-as-identifier.rs8
-rw-r--r--src/test/compile-fail/keyword-true-as-identifier.rs8
-rw-r--r--src/test/compile-fail/macro-context.rs2
-rw-r--r--src/test/compile-fail/macro-incomplete-parse.rs2
-rw-r--r--src/test/compile-fail/privacy/restricted/ty-params.rs20
-rw-r--r--src/test/compile-fail/qualified-path-params-2.rs31
-rw-r--r--src/test/compile-fail/qualified-path-params.rs33
-rw-r--r--src/test/compile-fail/reserved-become.rs2
-rw-r--r--src/test/compile-fail/self_type_keyword.rs2
-rw-r--r--src/test/compile-fail/token-error-correct.rs4
-rw-r--r--src/test/compile-fail/use-keyword.rs23
-rw-r--r--src/test/compile-fail/use-mod-4.rs14
-rw-r--r--src/test/compile-fail/vec-macro-with-comma-only.rs2
17 files changed, 137 insertions, 24 deletions
diff --git a/src/test/compile-fail/fail-simple.rs b/src/test/compile-fail/fail-simple.rs
index 97b709592a9..e889d354770 100644
--- a/src/test/compile-fail/fail-simple.rs
+++ b/src/test/compile-fail/fail-simple.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-
-// error-pattern:unexpected token
 fn main() {
-  panic!(@);
+    panic!(@); //~ ERROR expected expression, found `@`
 }
diff --git a/src/test/compile-fail/import-ty-params.rs b/src/test/compile-fail/import-ty-params.rs
index 66d4d6d0621..7344f31535f 100644
--- a/src/test/compile-fail/import-ty-params.rs
+++ b/src/test/compile-fail/import-ty-params.rs
@@ -20,6 +20,6 @@ macro_rules! import {
     ($p: path) => (use $p;);
 }
 
-import! { a::b::c::S<u8> } //~ERROR type or lifetime parameter is found in import path
+import! { a::b::c::S<u8> } //~ERROR type or lifetime parameters in import path
 
 fn main() {}
diff --git a/src/test/compile-fail/issue-10636-2.rs b/src/test/compile-fail/issue-10636-2.rs
index 747252d5924..beaf9e5059f 100644
--- a/src/test/compile-fail/issue-10636-2.rs
+++ b/src/test/compile-fail/issue-10636-2.rs
@@ -15,4 +15,4 @@ pub fn trace_option(option: Option<isize>) {
     option.map(|some| 42; //~ NOTE: unclosed delimiter
                           //~^ ERROR: expected one of
 } //~ ERROR: incorrect close delimiter
-//~^ ERROR: unexpected token
+//~^ ERROR: expected expression, found `)`
diff --git a/src/test/compile-fail/issue-31804.rs b/src/test/compile-fail/issue-31804.rs
index b6a04bee85d..cea52b11c5d 100644
--- a/src/test/compile-fail/issue-31804.rs
+++ b/src/test/compile-fail/issue-31804.rs
@@ -13,4 +13,4 @@
 
 fn main() {
     let
-} //~ ERROR unexpected token: `}`
+} //~ ERROR expected pattern, found `}`
diff --git a/src/test/compile-fail/keyword-false-as-identifier.rs b/src/test/compile-fail/keyword-false-as-identifier.rs
index 60caca3da57..e8af94f16b1 100644
--- a/src/test/compile-fail/keyword-false-as-identifier.rs
+++ b/src/test/compile-fail/keyword-false-as-identifier.rs
@@ -1,4 +1,4 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -8,10 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// ignore-test -- FIXME #33010
-
-// This file was auto-generated using 'src/etc/generate-keyword-tests.py false'
-
 fn main() {
-    let false = "foo"; //~ error: ident
+    let false = "foo"; //~ error: mismatched types
 }
diff --git a/src/test/compile-fail/keyword-true-as-identifier.rs b/src/test/compile-fail/keyword-true-as-identifier.rs
index 716a0ebf21c..90414fa912d 100644
--- a/src/test/compile-fail/keyword-true-as-identifier.rs
+++ b/src/test/compile-fail/keyword-true-as-identifier.rs
@@ -1,4 +1,4 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -8,10 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// ignore-test -- FIXME #33010
-
-// This file was auto-generated using 'src/etc/generate-keyword-tests.py true'
-
 fn main() {
-    let true = "foo"; //~ error: ident
+    let true = "foo"; //~ error: mismatched types
 }
diff --git a/src/test/compile-fail/macro-context.rs b/src/test/compile-fail/macro-context.rs
index 8fa5e0a7089..5d07f0747ff 100644
--- a/src/test/compile-fail/macro-context.rs
+++ b/src/test/compile-fail/macro-context.rs
@@ -12,7 +12,7 @@
 
 // (typeof used because it's surprisingly hard to find an unparsed token after a stmt)
 macro_rules! m {
-    () => ( i ; typeof );   //~ ERROR `typeof` is a reserved keyword
+    () => ( i ; typeof );   //~ ERROR expected expression, found reserved keyword `typeof`
                             //~| ERROR macro expansion ignores token `typeof`
                             //~| ERROR macro expansion ignores token `;`
                             //~| ERROR macro expansion ignores token `;`
diff --git a/src/test/compile-fail/macro-incomplete-parse.rs b/src/test/compile-fail/macro-incomplete-parse.rs
index 0d5f9079649..8d515622e53 100644
--- a/src/test/compile-fail/macro-incomplete-parse.rs
+++ b/src/test/compile-fail/macro-incomplete-parse.rs
@@ -19,7 +19,7 @@ macro_rules! ignored_item {
 }
 
 macro_rules! ignored_expr {
-    () => ( 1,  //~ ERROR unexpected token: `,`
+    () => ( 1,  //~ ERROR expected expression, found `,`
             2 )
 }
 
diff --git a/src/test/compile-fail/privacy/restricted/ty-params.rs b/src/test/compile-fail/privacy/restricted/ty-params.rs
new file mode 100644
index 00000000000..04d8e983304
--- /dev/null
+++ b/src/test/compile-fail/privacy/restricted/ty-params.rs
@@ -0,0 +1,20 @@
+// Copyright 2016 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.
+
+#![feature(pub_restricted)]
+
+macro_rules! m {
+    ($p: path) => (pub($p) struct Z;)
+}
+
+struct S<T>(T);
+m!{ S<u8> } //~ ERROR type or lifetime parameters in visibility path
+
+fn main() {}
diff --git a/src/test/compile-fail/qualified-path-params-2.rs b/src/test/compile-fail/qualified-path-params-2.rs
new file mode 100644
index 00000000000..5c661bfcdc0
--- /dev/null
+++ b/src/test/compile-fail/qualified-path-params-2.rs
@@ -0,0 +1,31 @@
+// Copyright 2016 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.
+
+// Check that qualified paths with type parameters
+// fail during type checking and not during parsing
+
+struct S;
+
+trait Tr {
+    type A;
+}
+
+impl Tr for S {
+    type A = S;
+}
+
+impl S {
+    fn f<T>() {}
+}
+
+type A = <S as Tr>::A::f<u8>; //~ ERROR type parameters are not allowed on this type
+//~^ ERROR ambiguous associated type; specify the type using the syntax `<<S as Tr>::A as Trait>::f`
+
+fn main() {}
diff --git a/src/test/compile-fail/qualified-path-params.rs b/src/test/compile-fail/qualified-path-params.rs
new file mode 100644
index 00000000000..002080f4cb4
--- /dev/null
+++ b/src/test/compile-fail/qualified-path-params.rs
@@ -0,0 +1,33 @@
+// Copyright 2016 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.
+
+// Check that qualified paths with type parameters
+// fail during type checking and not during parsing
+
+struct S;
+
+trait Tr {
+    type A;
+}
+
+impl Tr for S {
+    type A = S;
+}
+
+impl S {
+    fn f<T>() {}
+}
+
+fn main() {
+    match 10 {
+        <S as Tr>::A::f::<u8> => {} //~ ERROR `f` is not an associated const
+        0 ... <S as Tr>::A::f::<u8> => {} //~ ERROR only char and numeric types are allowed in range
+    }
+}
diff --git a/src/test/compile-fail/reserved-become.rs b/src/test/compile-fail/reserved-become.rs
index 82e9ebc10d1..bcda61e363d 100644
--- a/src/test/compile-fail/reserved-become.rs
+++ b/src/test/compile-fail/reserved-become.rs
@@ -10,5 +10,5 @@
 
 fn main() {
     let become = 0;
-    //~^ ERROR `become` is a reserved keyword
+    //~^ ERROR expected pattern, found reserved keyword `become`
 }
diff --git a/src/test/compile-fail/self_type_keyword.rs b/src/test/compile-fail/self_type_keyword.rs
index b28f48bb105..b9c9d7a389b 100644
--- a/src/test/compile-fail/self_type_keyword.rs
+++ b/src/test/compile-fail/self_type_keyword.rs
@@ -14,7 +14,7 @@ struct Self;
 //~^ ERROR expected identifier, found keyword `Self`
 
 struct Bar<'Self>;
-//~^ ERROR invalid lifetime name
+//~^ ERROR lifetimes cannot use keyword names
 
 pub fn main() {
     let Self = 5;
diff --git a/src/test/compile-fail/token-error-correct.rs b/src/test/compile-fail/token-error-correct.rs
index 6c54acd7bdb..f5fecf3e174 100644
--- a/src/test/compile-fail/token-error-correct.rs
+++ b/src/test/compile-fail/token-error-correct.rs
@@ -13,8 +13,10 @@
 fn main() {
     foo(bar(; //~ NOTE: unclosed delimiter
     //~^ NOTE: unclosed delimiter
-    //~^^ ERROR: unexpected token: `;`
+    //~^^ ERROR: expected expression, found `;`
     //~^^^ ERROR: unresolved name `bar`
     //~^^^^ ERROR: unresolved name `foo`
+    //~^^^^^ ERROR: expected one of `)`, `,`, `.`, `<`, `?`
 } //~ ERROR: incorrect close delimiter: `}`
 //~^ ERROR: incorrect close delimiter: `}`
+//~^^ ERROR: expected expression, found `)`
diff --git a/src/test/compile-fail/use-keyword.rs b/src/test/compile-fail/use-keyword.rs
new file mode 100644
index 00000000000..040db025567
--- /dev/null
+++ b/src/test/compile-fail/use-keyword.rs
@@ -0,0 +1,23 @@
+// Copyright 2016 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.
+
+// Check that imports with nakes super and self don't fail during parsing
+// FIXME: this shouldn't fail during name resolution either
+
+mod a {
+    mod b {
+        use self as A; //~ ERROR `self` imports are only allowed within a { } list
+        //~^ ERROR unresolved import `self`. There is no `self` in the crate root
+        use super as B; //~ ERROR unresolved import `super`. There is no `super` in the crate root
+        use super::{self as C}; //~ERROR unresolved import `super`. There is no `super` in the crate
+    }
+}
+
+fn main() {}
diff --git a/src/test/compile-fail/use-mod-4.rs b/src/test/compile-fail/use-mod-4.rs
new file mode 100644
index 00000000000..146d37f41d6
--- /dev/null
+++ b/src/test/compile-fail/use-mod-4.rs
@@ -0,0 +1,14 @@
+// Copyright 2014 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.
+
+use foo::self; //~ ERROR unresolved import `foo::self`
+//~^ ERROR `self` imports are only allowed within a { } list
+
+fn main() {}
diff --git a/src/test/compile-fail/vec-macro-with-comma-only.rs b/src/test/compile-fail/vec-macro-with-comma-only.rs
index 8c8e789cd96..346cf1ec555 100644
--- a/src/test/compile-fail/vec-macro-with-comma-only.rs
+++ b/src/test/compile-fail/vec-macro-with-comma-only.rs
@@ -9,5 +9,5 @@
 // except according to those terms.
 
 pub fn main() {
-    vec!(,); //~ ERROR unexpected token
+    vec!(,); //~ ERROR expected expression, found `,`
 }