diff options
Diffstat (limited to 'src/test/parse-fail')
50 files changed, 171 insertions, 104 deletions
diff --git a/src/test/parse-fail/issue-10412.rs b/src/test/parse-fail/issue-10412.rs index b75e7b12bbd..fc2598d1e9d 100644 --- a/src/test/parse-fail/issue-10412.rs +++ b/src/test/parse-fail/issue-10412.rs @@ -11,17 +11,17 @@ // compile-flags: -Z parse-only -Z continue-parse-after-error -trait Serializable<'self, T> { //~ ERROR no longer a special lifetime - fn serialize(val : &'self T) -> Vec<u8> ; //~ ERROR no longer a special lifetime - fn deserialize(repr : &[u8]) -> &'self T; //~ ERROR no longer a special lifetime +trait Serializable<'self, T> { //~ ERROR lifetimes cannot use keyword names + fn serialize(val : &'self T) -> Vec<u8> ; //~ ERROR lifetimes cannot use keyword names + fn deserialize(repr : &[u8]) -> &'self T; //~ ERROR lifetimes cannot use keyword names } -impl<'self> Serializable<str> for &'self str { //~ ERROR no longer a special lifetime - //~^ ERROR no longer a special lifetime - fn serialize(val : &'self str) -> Vec<u8> { //~ ERROR no longer a special lifetime +impl<'self> Serializable<str> for &'self str { //~ ERROR lifetimes cannot use keyword names + //~^ ERROR lifetimes cannot use keyword names + fn serialize(val : &'self str) -> Vec<u8> { //~ ERROR lifetimes cannot use keyword names vec!(1) } - fn deserialize(repr: &[u8]) -> &'self str { //~ ERROR no longer a special lifetime + fn deserialize(repr: &[u8]) -> &'self str { //~ ERROR lifetimes cannot use keyword names "hi" } } diff --git a/src/test/parse-fail/issue-14303-path.rs b/src/test/parse-fail/issue-14303-path.rs index 7c30b5f2629..431a917c2d9 100644 --- a/src/test/parse-fail/issue-14303-path.rs +++ b/src/test/parse-fail/issue-14303-path.rs @@ -12,4 +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 +//~^^ ERROR expected pattern, found `'c` diff --git a/src/test/parse-fail/issue-32505.rs b/src/test/parse-fail/issue-32505.rs index e697e98bc06..246941ff259 100644 --- a/src/test/parse-fail/issue-32505.rs +++ b/src/test/parse-fail/issue-32505.rs @@ -11,7 +11,7 @@ // compile-flags: -Z parse-only -Z continue-parse-after-error pub fn test() { - foo(|_|) //~ ERROR unexpected token: `)` + foo(|_|) //~ ERROR expected expression, found `)` } fn main() { } diff --git a/src/test/parse-fail/keyword-abstract.rs b/src/test/parse-fail/keyword-abstract.rs index bd3fbbe79a8..2db5a5c583a 100644 --- a/src/test/parse-fail/keyword-abstract.rs +++ b/src/test/parse-fail/keyword-abstract.rs @@ -11,5 +11,5 @@ // compile-flags: -Z parse-only fn main() { - let abstract = (); //~ ERROR `abstract` is a reserved keyword + let abstract = (); //~ ERROR expected pattern, found reserved keyword `abstract` } diff --git a/src/test/parse-fail/keyword-as-as-identifier.rs b/src/test/parse-fail/keyword-as-as-identifier.rs index bc05a7c4f25..c6070c456e8 100644 --- a/src/test/parse-fail/keyword-as-as-identifier.rs +++ b/src/test/parse-fail/keyword-as-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. // @@ -13,5 +13,5 @@ // This file was auto-generated using 'src/etc/generate-keyword-tests.py as' fn main() { - let as = "foo"; //~ error: ident + let as = "foo"; //~ error: expected pattern, found keyword `as` } diff --git a/src/test/parse-fail/use-mod-4.rs b/src/test/parse-fail/keyword-box-as-identifier.rs index bcafa4e9fde..b5abe14dbe8 100644 --- a/src/test/parse-fail/use-mod-4.rs +++ b/src/test/parse-fail/keyword-box-as-identifier.rs @@ -1,4 +1,4 @@ -// Copyright 2014 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. // @@ -10,7 +10,6 @@ // compile-flags: -Z parse-only -use foo::self; -//~^ ERROR expected identifier, found keyword `self` - -fn main() {} +fn main() { + let box = "foo"; //~ error: expected pattern, found `=` +} diff --git a/src/test/parse-fail/keyword-break-as-identifier.rs b/src/test/parse-fail/keyword-break-as-identifier.rs index bd7527f399e..65c775fa1b6 100644 --- a/src/test/parse-fail/keyword-break-as-identifier.rs +++ b/src/test/parse-fail/keyword-break-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. // @@ -13,5 +13,5 @@ // This file was auto-generated using 'src/etc/generate-keyword-tests.py break' fn main() { - let break = "foo"; //~ error: ident + let break = "foo"; //~ error: expected pattern, found keyword `break` } diff --git a/src/test/parse-fail/keyword-const-as-identifier.rs b/src/test/parse-fail/keyword-const-as-identifier.rs new file mode 100644 index 00000000000..6ecf14957e3 --- /dev/null +++ b/src/test/parse-fail/keyword-const-as-identifier.rs @@ -0,0 +1,17 @@ +// 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. + +// compile-flags: -Z parse-only + +// This file was auto-generated using 'src/etc/generate-keyword-tests.py const' + +fn main() { + let const = "foo"; //~ error: expected pattern, found keyword `const` +} diff --git a/src/test/parse-fail/keyword-continue-as-identifier.rs b/src/test/parse-fail/keyword-continue-as-identifier.rs new file mode 100644 index 00000000000..87377ac8364 --- /dev/null +++ b/src/test/parse-fail/keyword-continue-as-identifier.rs @@ -0,0 +1,17 @@ +// 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. + +// compile-flags: -Z parse-only + +// This file was auto-generated using 'src/etc/generate-keyword-tests.py continue' + +fn main() { + let continue = "foo"; //~ error: expected pattern, found keyword `continue` +} diff --git a/src/test/parse-fail/keyword-crate-as-identifier.rs b/src/test/parse-fail/keyword-crate-as-identifier.rs new file mode 100644 index 00000000000..8a914ca7b17 --- /dev/null +++ b/src/test/parse-fail/keyword-crate-as-identifier.rs @@ -0,0 +1,17 @@ +// 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. + +// compile-flags: -Z parse-only + +// This file was auto-generated using 'src/etc/generate-keyword-tests.py crate' + +fn main() { + let crate = "foo"; //~ error: expected pattern, found keyword `crate` +} diff --git a/src/test/parse-fail/keyword-else-as-identifier.rs b/src/test/parse-fail/keyword-else-as-identifier.rs index 24bd18a738f..6878f7fea03 100644 --- a/src/test/parse-fail/keyword-else-as-identifier.rs +++ b/src/test/parse-fail/keyword-else-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. // @@ -13,5 +13,5 @@ // This file was auto-generated using 'src/etc/generate-keyword-tests.py else' fn main() { - let else = "foo"; //~ error: ident + let else = "foo"; //~ error: expected pattern, found keyword `else` } diff --git a/src/test/parse-fail/keyword-enum-as-identifier.rs b/src/test/parse-fail/keyword-enum-as-identifier.rs index e4745270414..042a02d79e0 100644 --- a/src/test/parse-fail/keyword-enum-as-identifier.rs +++ b/src/test/parse-fail/keyword-enum-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. // @@ -13,5 +13,5 @@ // This file was auto-generated using 'src/etc/generate-keyword-tests.py enum' fn main() { - let enum = "foo"; //~ error: ident + let enum = "foo"; //~ error: expected pattern, found keyword `enum` } diff --git a/src/test/parse-fail/keyword-extern-as-identifier.rs b/src/test/parse-fail/keyword-extern-as-identifier.rs index 579cd9f9166..3bbe24ed56c 100644 --- a/src/test/parse-fail/keyword-extern-as-identifier.rs +++ b/src/test/parse-fail/keyword-extern-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. // @@ -13,5 +13,5 @@ // This file was auto-generated using 'src/etc/generate-keyword-tests.py extern' fn main() { - let extern = "foo"; //~ error: ident + let extern = "foo"; //~ error: expected pattern, found keyword `extern` } diff --git a/src/test/parse-fail/keyword-final.rs b/src/test/parse-fail/keyword-final.rs index 4b06312d099..be29a739443 100644 --- a/src/test/parse-fail/keyword-final.rs +++ b/src/test/parse-fail/keyword-final.rs @@ -11,5 +11,5 @@ // compile-flags: -Z parse-only fn main() { - let final = (); //~ ERROR `final` is a reserved keyword + let final = (); //~ ERROR expected pattern, found reserved keyword `final` } diff --git a/src/test/parse-fail/keyword-fn-as-identifier.rs b/src/test/parse-fail/keyword-fn-as-identifier.rs index 0ace9ddf1f0..0d454f67d1c 100644 --- a/src/test/parse-fail/keyword-fn-as-identifier.rs +++ b/src/test/parse-fail/keyword-fn-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. // @@ -13,5 +13,5 @@ // This file was auto-generated using 'src/etc/generate-keyword-tests.py fn' fn main() { - let fn = "foo"; //~ error: ident + let fn = "foo"; //~ error: expected pattern, found keyword `fn` } diff --git a/src/test/parse-fail/keyword-for-as-identifier.rs b/src/test/parse-fail/keyword-for-as-identifier.rs index 035c87b80bb..d341669f727 100644 --- a/src/test/parse-fail/keyword-for-as-identifier.rs +++ b/src/test/parse-fail/keyword-for-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. // @@ -13,5 +13,5 @@ // This file was auto-generated using 'src/etc/generate-keyword-tests.py for' fn main() { - let for = "foo"; //~ error: ident + let for = "foo"; //~ error: expected pattern, found keyword `for` } diff --git a/src/test/parse-fail/keyword-if-as-identifier.rs b/src/test/parse-fail/keyword-if-as-identifier.rs index 1aad0a780f9..417e40425e0 100644 --- a/src/test/parse-fail/keyword-if-as-identifier.rs +++ b/src/test/parse-fail/keyword-if-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. // @@ -13,5 +13,5 @@ // This file was auto-generated using 'src/etc/generate-keyword-tests.py if' fn main() { - let if = "foo"; //~ error: ident + let if = "foo"; //~ error: expected pattern, found keyword `if` } diff --git a/src/test/parse-fail/keyword-impl-as-identifier.rs b/src/test/parse-fail/keyword-impl-as-identifier.rs index 585109505d4..fe97c191f68 100644 --- a/src/test/parse-fail/keyword-impl-as-identifier.rs +++ b/src/test/parse-fail/keyword-impl-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. // @@ -13,5 +13,5 @@ // This file was auto-generated using 'src/etc/generate-keyword-tests.py impl' fn main() { - let impl = "foo"; //~ error: ident + let impl = "foo"; //~ error: expected pattern, found keyword `impl` } diff --git a/src/test/parse-fail/lifetime-obsoleted-self.rs b/src/test/parse-fail/keyword-in-as-identifier.rs index e8b76750eb9..c0f9396b981 100644 --- a/src/test/parse-fail/lifetime-obsoleted-self.rs +++ b/src/test/parse-fail/keyword-in-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. // @@ -10,6 +10,8 @@ // compile-flags: -Z parse-only -fn baz(a: &'self isize) { } //~ ERROR invalid lifetime name: 'self is no longer a special lifetime +// This file was auto-generated using 'src/etc/generate-keyword-tests.py in' -fn main() { } +fn main() { + let in = "foo"; //~ error: expected pattern, found keyword `in` +} diff --git a/src/test/parse-fail/keyword-let-as-identifier.rs b/src/test/parse-fail/keyword-let-as-identifier.rs index 07bc7901686..5d6dca78d78 100644 --- a/src/test/parse-fail/keyword-let-as-identifier.rs +++ b/src/test/parse-fail/keyword-let-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. // @@ -13,5 +13,5 @@ // This file was auto-generated using 'src/etc/generate-keyword-tests.py let' fn main() { - let let = "foo"; //~ error: ident + let let = "foo"; //~ error: expected pattern, found keyword `let` } diff --git a/src/test/parse-fail/keyword-loop-as-identifier.rs b/src/test/parse-fail/keyword-loop-as-identifier.rs index 7b2b10a2d6d..7c3d11d67f6 100644 --- a/src/test/parse-fail/keyword-loop-as-identifier.rs +++ b/src/test/parse-fail/keyword-loop-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. // @@ -13,5 +13,5 @@ // This file was auto-generated using 'src/etc/generate-keyword-tests.py loop' fn main() { - let loop = "foo"; //~ error: ident + let loop = "foo"; //~ error: expected pattern, found keyword `loop` } diff --git a/src/test/parse-fail/keyword-match-as-identifier.rs b/src/test/parse-fail/keyword-match-as-identifier.rs index 528873c1794..7c727f44da7 100644 --- a/src/test/parse-fail/keyword-match-as-identifier.rs +++ b/src/test/parse-fail/keyword-match-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. // @@ -13,5 +13,5 @@ // This file was auto-generated using 'src/etc/generate-keyword-tests.py match' fn main() { - let match = "foo"; //~ error: ident + let match = "foo"; //~ error: expected pattern, found keyword `match` } diff --git a/src/test/parse-fail/keyword-mod-as-identifier.rs b/src/test/parse-fail/keyword-mod-as-identifier.rs index b29bcbc76c3..85b4cc2e02c 100644 --- a/src/test/parse-fail/keyword-mod-as-identifier.rs +++ b/src/test/parse-fail/keyword-mod-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. // @@ -13,5 +13,5 @@ // This file was auto-generated using 'src/etc/generate-keyword-tests.py mod' fn main() { - let mod = "foo"; //~ error: ident + let mod = "foo"; //~ error: expected pattern, found keyword `mod` } diff --git a/src/test/parse-fail/keyword-move-as-identifier.rs b/src/test/parse-fail/keyword-move-as-identifier.rs new file mode 100644 index 00000000000..b785ac0058c --- /dev/null +++ b/src/test/parse-fail/keyword-move-as-identifier.rs @@ -0,0 +1,17 @@ +// 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. + +// compile-flags: -Z parse-only + +// This file was auto-generated using 'src/etc/generate-keyword-tests.py move' + +fn main() { + let move = "foo"; //~ error: expected pattern, found keyword `move` +} diff --git a/src/test/parse-fail/keyword-mut-as-identifier.rs b/src/test/parse-fail/keyword-mut-as-identifier.rs index b637d07d8b6..0aeca9b34ab 100644 --- a/src/test/parse-fail/keyword-mut-as-identifier.rs +++ b/src/test/parse-fail/keyword-mut-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. // @@ -10,8 +10,6 @@ // compile-flags: -Z parse-only -// This file was auto-generated using 'src/etc/generate-keyword-tests.py mut' - fn main() { - let mut = "foo"; //~ error: ident + let mut = "foo"; //~ error: expected identifier, found `=` } diff --git a/src/test/parse-fail/keyword-override.rs b/src/test/parse-fail/keyword-override.rs index 3f79e437189..60333762b33 100644 --- a/src/test/parse-fail/keyword-override.rs +++ b/src/test/parse-fail/keyword-override.rs @@ -11,5 +11,5 @@ // compile-flags: -Z parse-only fn main() { - let override = (); //~ ERROR `override` is a reserved keyword + let override = (); //~ ERROR expected pattern, found reserved keyword `override` } diff --git a/src/test/parse-fail/keyword-pub-as-identifier.rs b/src/test/parse-fail/keyword-pub-as-identifier.rs index 959bbfbf882..92337286970 100644 --- a/src/test/parse-fail/keyword-pub-as-identifier.rs +++ b/src/test/parse-fail/keyword-pub-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. // @@ -13,5 +13,5 @@ // This file was auto-generated using 'src/etc/generate-keyword-tests.py pub' fn main() { - let pub = "foo"; //~ error: ident + let pub = "foo"; //~ error: expected pattern, found keyword `pub` } diff --git a/src/test/parse-fail/keyword-ref-as-identifier.rs b/src/test/parse-fail/keyword-ref-as-identifier.rs index 3db6d11c2e8..a689c4eeea4 100644 --- a/src/test/parse-fail/keyword-ref-as-identifier.rs +++ b/src/test/parse-fail/keyword-ref-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. // @@ -10,8 +10,6 @@ // compile-flags: -Z parse-only -// This file was auto-generated using 'src/etc/generate-keyword-tests.py ref' - fn main() { - let ref = "foo"; //~ error: ident + let ref = "foo"; //~ error: expected identifier, found `=` } diff --git a/src/test/parse-fail/keyword-return-as-identifier.rs b/src/test/parse-fail/keyword-return-as-identifier.rs index df8aeba6d71..bcf7f137543 100644 --- a/src/test/parse-fail/keyword-return-as-identifier.rs +++ b/src/test/parse-fail/keyword-return-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. // @@ -13,5 +13,5 @@ // This file was auto-generated using 'src/etc/generate-keyword-tests.py return' fn main() { - let return = "foo"; //~ error: ident + let return = "foo"; //~ error: expected pattern, found keyword `return` } diff --git a/src/test/parse-fail/keyword-self-as-identifier.rs b/src/test/parse-fail/keyword-self-as-identifier.rs index 0e0d07ca6a5..f8b93a1796b 100644 --- a/src/test/parse-fail/keyword-self-as-identifier.rs +++ b/src/test/parse-fail/keyword-self-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. // @@ -10,8 +10,6 @@ // compile-flags: -Z parse-only -// This file was auto-generated using 'src/etc/generate-keyword-tests.py self' - fn main() { - let self = "foo"; //~ error: ident + let Self = "foo"; //~ error: expected identifier, found keyword `Self` } diff --git a/src/test/parse-fail/keyword-static-as-identifier.rs b/src/test/parse-fail/keyword-static-as-identifier.rs index d5b529af4b8..793262266a3 100644 --- a/src/test/parse-fail/keyword-static-as-identifier.rs +++ b/src/test/parse-fail/keyword-static-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. // @@ -13,5 +13,5 @@ // This file was auto-generated using 'src/etc/generate-keyword-tests.py static' fn main() { - let static = "foo"; //~ error: ident + let static = "foo"; //~ error: expected pattern, found keyword `static` } diff --git a/src/test/parse-fail/keyword-struct-as-identifier.rs b/src/test/parse-fail/keyword-struct-as-identifier.rs index 7d2160dfd29..591bd25db65 100644 --- a/src/test/parse-fail/keyword-struct-as-identifier.rs +++ b/src/test/parse-fail/keyword-struct-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. // @@ -13,5 +13,5 @@ // This file was auto-generated using 'src/etc/generate-keyword-tests.py struct' fn main() { - let struct = "foo"; //~ error: ident + let struct = "foo"; //~ error: expected pattern, found keyword `struct` } diff --git a/src/test/parse-fail/keyword-super-as-identifier.rs b/src/test/parse-fail/keyword-super-as-identifier.rs index 4d866918868..a48683a4f54 100644 --- a/src/test/parse-fail/keyword-super-as-identifier.rs +++ b/src/test/parse-fail/keyword-super-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. // @@ -10,8 +10,6 @@ // compile-flags: -Z parse-only -// This file was auto-generated using 'src/etc/generate-keyword-tests.py super' - fn main() { - let super = "foo"; //~ error: ident + let super = "foo"; //~ error: expected identifier, found keyword `super` } diff --git a/src/test/parse-fail/keyword-trait-as-identifier.rs b/src/test/parse-fail/keyword-trait-as-identifier.rs index 7a8be0baa27..bdb5d264b03 100644 --- a/src/test/parse-fail/keyword-trait-as-identifier.rs +++ b/src/test/parse-fail/keyword-trait-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. // @@ -13,5 +13,5 @@ // This file was auto-generated using 'src/etc/generate-keyword-tests.py trait' fn main() { - let trait = "foo"; //~ error: ident + let trait = "foo"; //~ error: expected pattern, found keyword `trait` } diff --git a/src/test/parse-fail/keyword-type-as-identifier.rs b/src/test/parse-fail/keyword-type-as-identifier.rs index c76bea89ab4..2ba99d098de 100644 --- a/src/test/parse-fail/keyword-type-as-identifier.rs +++ b/src/test/parse-fail/keyword-type-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. // @@ -13,5 +13,5 @@ // This file was auto-generated using 'src/etc/generate-keyword-tests.py type' fn main() { - let type = "foo"; //~ error: ident + let type = "foo"; //~ error: expected pattern, found keyword `type` } diff --git a/src/test/parse-fail/keyword-typeof.rs b/src/test/parse-fail/keyword-typeof.rs index 29ec4f5844b..40e26bd375a 100644 --- a/src/test/parse-fail/keyword-typeof.rs +++ b/src/test/parse-fail/keyword-typeof.rs @@ -11,5 +11,5 @@ // compile-flags: -Z parse-only fn main() { - let typeof = (); //~ ERROR `typeof` is a reserved keyword + let typeof = (); //~ ERROR expected pattern, found reserved keyword `typeof` } diff --git a/src/test/parse-fail/keyword-unsafe-as-identifier.rs b/src/test/parse-fail/keyword-unsafe-as-identifier.rs index d3c48c6ded0..a72723e566d 100644 --- a/src/test/parse-fail/keyword-unsafe-as-identifier.rs +++ b/src/test/parse-fail/keyword-unsafe-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. // @@ -13,5 +13,5 @@ // This file was auto-generated using 'src/etc/generate-keyword-tests.py unsafe' fn main() { - let unsafe = "foo"; //~ error: ident + let unsafe = "foo"; //~ error: expected pattern, found keyword `unsafe` } diff --git a/src/test/parse-fail/keyword-use-as-identifier.rs b/src/test/parse-fail/keyword-use-as-identifier.rs index d3815c650a3..de74907ff20 100644 --- a/src/test/parse-fail/keyword-use-as-identifier.rs +++ b/src/test/parse-fail/keyword-use-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. // @@ -13,5 +13,5 @@ // This file was auto-generated using 'src/etc/generate-keyword-tests.py use' fn main() { - let use = "foo"; //~ error: ident + let use = "foo"; //~ error: expected pattern, found keyword `use` } diff --git a/src/test/parse-fail/keyword-where-as-identifier.rs b/src/test/parse-fail/keyword-where-as-identifier.rs new file mode 100644 index 00000000000..4b7c8920b13 --- /dev/null +++ b/src/test/parse-fail/keyword-where-as-identifier.rs @@ -0,0 +1,17 @@ +// 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. + +// compile-flags: -Z parse-only + +// This file was auto-generated using 'src/etc/generate-keyword-tests.py where' + +fn main() { + let where = "foo"; //~ error: expected pattern, found keyword `where` +} diff --git a/src/test/parse-fail/keyword-while-as-identifier.rs b/src/test/parse-fail/keyword-while-as-identifier.rs index 331fdc07cc1..01793caa38a 100644 --- a/src/test/parse-fail/keyword-while-as-identifier.rs +++ b/src/test/parse-fail/keyword-while-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. // @@ -13,5 +13,5 @@ // This file was auto-generated using 'src/etc/generate-keyword-tests.py while' fn main() { - let while = "foo"; //~ error: ident + let while = "foo"; //~ error: expected pattern, found keyword `while` } diff --git a/src/test/parse-fail/keywords-followed-by-double-colon.rs b/src/test/parse-fail/keywords-followed-by-double-colon.rs index 5e27d3e4f38..bb8a1dfdb19 100644 --- a/src/test/parse-fail/keywords-followed-by-double-colon.rs +++ b/src/test/parse-fail/keywords-followed-by-double-colon.rs @@ -12,5 +12,5 @@ fn main() { struct::foo(); //~ ERROR expected identifier - mut::baz(); //~ ERROR expected identifier + mut::baz(); //~ ERROR expected expression, found keyword `mut` } diff --git a/src/test/parse-fail/lifetime-no-keyword.rs b/src/test/parse-fail/lifetime-no-keyword.rs index 84b02e6ba09..9ca81d9918e 100644 --- a/src/test/parse-fail/lifetime-no-keyword.rs +++ b/src/test/parse-fail/lifetime-no-keyword.rs @@ -12,6 +12,7 @@ fn foo<'a>(a: &'a isize) { } fn bar(a: &'static isize) { } -fn baz(a: &'let isize) { } //~ ERROR invalid lifetime name +fn baz(a: &'let isize) { } //~ ERROR lifetimes cannot use keyword names +fn zab(a: &'self isize) { } //~ ERROR lifetimes cannot use keyword names fn main() { } diff --git a/src/test/parse-fail/match-arrows-block-then-binop.rs b/src/test/parse-fail/match-arrows-block-then-binop.rs index 3026e159a44..e8cfb77f059 100644 --- a/src/test/parse-fail/match-arrows-block-then-binop.rs +++ b/src/test/parse-fail/match-arrows-block-then-binop.rs @@ -14,6 +14,6 @@ fn main() { match 0 { 0 => { - } + 5 //~ ERROR unexpected token: `+` + } + 5 //~ ERROR expected pattern, found `+` } } diff --git a/src/test/parse-fail/obsolete-proc.rs b/src/test/parse-fail/obsolete-proc.rs index 1ef8cd2714d..648c46d246c 100644 --- a/src/test/parse-fail/obsolete-proc.rs +++ b/src/test/parse-fail/obsolete-proc.rs @@ -12,9 +12,8 @@ // Test that we generate obsolete syntax errors around usages of `proc`. -fn foo(p: proc()) { } //~ ERROR `proc` is a reserved keyword +fn foo(p: proc()) { } //~ ERROR expected type, found reserved keyword `proc` -fn bar() { proc() 1; } //~ ERROR `proc` is a reserved keyword - //~^ ERROR expected +fn bar() { proc() 1; } //~ ERROR expected expression, found reserved keyword `proc` fn main() { } diff --git a/src/test/parse-fail/removed-syntax-mode.rs b/src/test/parse-fail/removed-syntax-mode.rs index 4dafc36e912..6e99f8b3eea 100644 --- a/src/test/parse-fail/removed-syntax-mode.rs +++ b/src/test/parse-fail/removed-syntax-mode.rs @@ -10,4 +10,4 @@ // compile-flags: -Z parse-only -fn f(+x: isize) {} //~ ERROR unexpected token: `+` +fn f(+x: isize) {} //~ ERROR expected pattern, found `+` diff --git a/src/test/parse-fail/removed-syntax-mut-vec-expr.rs b/src/test/parse-fail/removed-syntax-mut-vec-expr.rs index 301bd0e8b1c..7e5bd27b497 100644 --- a/src/test/parse-fail/removed-syntax-mut-vec-expr.rs +++ b/src/test/parse-fail/removed-syntax-mut-vec-expr.rs @@ -11,7 +11,5 @@ // compile-flags: -Z parse-only fn f() { - let v = [mut 1, 2, 3, 4]; - //~^ ERROR expected identifier, found keyword `mut` - //~^^ ERROR expected one of `!`, `,`, `.`, `::`, `;`, `?`, `]`, `{`, or an operator, found `1` + let v = [mut 1, 2, 3, 4]; //~ ERROR expected expression, found keyword `mut` } diff --git a/src/test/parse-fail/removed-syntax-mut-vec-ty.rs b/src/test/parse-fail/removed-syntax-mut-vec-ty.rs index 91918f01bb0..0cdf1981a23 100644 --- a/src/test/parse-fail/removed-syntax-mut-vec-ty.rs +++ b/src/test/parse-fail/removed-syntax-mut-vec-ty.rs @@ -10,6 +10,4 @@ // compile-flags: -Z parse-only -type v = [mut isize]; - //~^ ERROR expected identifier, found keyword `mut` - //~^^ ERROR expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `isize` +type v = [mut isize]; //~ ERROR expected type, found keyword `mut` diff --git a/src/test/parse-fail/removed-syntax-uniq-mut-expr.rs b/src/test/parse-fail/removed-syntax-uniq-mut-expr.rs index 2f637cf0b4e..b16c77ab6b5 100644 --- a/src/test/parse-fail/removed-syntax-uniq-mut-expr.rs +++ b/src/test/parse-fail/removed-syntax-uniq-mut-expr.rs @@ -11,7 +11,5 @@ // compile-flags: -Z parse-only fn f() { - let a_box = box mut 42; - //~^ ERROR expected identifier, found keyword `mut` - //~^^ ERROR expected one of `!`, `.`, `::`, `;`, `?`, `{`, or an operator, found `42` + let a_box = box mut 42; //~ ERROR expected expression, found keyword `mut` } diff --git a/src/test/parse-fail/removed-syntax-uniq-mut-ty.rs b/src/test/parse-fail/removed-syntax-uniq-mut-ty.rs index e1637901266..9bd8dc9b11b 100644 --- a/src/test/parse-fail/removed-syntax-uniq-mut-ty.rs +++ b/src/test/parse-fail/removed-syntax-uniq-mut-ty.rs @@ -10,6 +10,4 @@ // compile-flags: -Z parse-only -type mut_box = Box<mut isize>; - //~^ ERROR expected identifier, found keyword `mut` - //~^^ ERROR expected one of `!`, `(`, `+`, `,`, `::`, `<`, or `>`, found `isize` +type mut_box = Box<mut isize>; //~ ERROR expected type, found keyword `mut` diff --git a/src/test/parse-fail/unsized2.rs b/src/test/parse-fail/unsized2.rs index a4a4c0dcfd9..f3af8740be9 100644 --- a/src/test/parse-fail/unsized2.rs +++ b/src/test/parse-fail/unsized2.rs @@ -15,8 +15,5 @@ fn f<X>() {} pub fn main() { - f<type>(); - //~^ ERROR expected identifier, found keyword `type` - //~^^ ERROR: chained comparison - //~^^^ HELP: use `::< + f<type>(); //~ ERROR expected expression, found keyword `type` } |
