diff options
| author | bors <bors@rust-lang.org> | 2016-04-24 13:47:22 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-04-24 13:47:22 -0700 |
| commit | 19304837c86cc406ee042c99e12fa34debae4e8a (patch) | |
| tree | 180cf9b6c1b7e850bf19c7101e112729ad381b6e /src/test | |
| parent | 91aea5cf87953788477ccaa3a37c3f2c855e7a0a (diff) | |
| parent | a31658de51444d1b5193ac203a1bd7ace5621f93 (diff) | |
| download | rust-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')
69 files changed, 339 insertions, 129 deletions
diff --git a/src/test/auxiliary/roman_numerals.rs b/src/test/auxiliary/roman_numerals.rs index c262b0dba25..839ece49c3e 100644 --- a/src/test/auxiliary/roman_numerals.rs +++ b/src/test/auxiliary/roman_numerals.rs @@ -48,7 +48,7 @@ fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree]) } let text = match args[0] { - TokenTree::Token(_, token::Ident(s, _)) => s.to_string(), + TokenTree::Token(_, token::Ident(s)) => s.to_string(), _ => { cx.span_err(sp, "argument should be a single identifier"); return DummyResult::any(sp); 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/parse-fail/use-mod-4.rs b/src/test/compile-fail/use-mod-4.rs index bcafa4e9fde..146d37f41d6 100644 --- a/src/test/parse-fail/use-mod-4.rs +++ b/src/test/compile-fail/use-mod-4.rs @@ -8,9 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: -Z parse-only - -use foo::self; -//~^ ERROR expected identifier, found keyword `self` +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 `,` } 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/lifetime-obsoleted-self.rs b/src/test/parse-fail/keyword-box-as-identifier.rs index e8b76750eb9..b5abe14dbe8 100644 --- a/src/test/parse-fail/lifetime-obsoleted-self.rs +++ b/src/test/parse-fail/keyword-box-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,6 @@ // compile-flags: -Z parse-only -fn baz(a: &'self isize) { } //~ ERROR invalid lifetime name: 'self is no longer a special lifetime - -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/keyword-in-as-identifier.rs b/src/test/parse-fail/keyword-in-as-identifier.rs new file mode 100644 index 00000000000..c0f9396b981 --- /dev/null +++ b/src/test/parse-fail/keyword-in-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 in' + +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` } diff --git a/src/test/run-pass/use-keyword-2.rs b/src/test/run-pass/use-keyword-2.rs new file mode 100644 index 00000000000..60016f59594 --- /dev/null +++ b/src/test/run-pass/use-keyword-2.rs @@ -0,0 +1,30 @@ +// 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. + +pub struct A; + +mod test { + pub use super :: A; + + pub use self :: A as B; +} + +impl A { + fn f() {} + fn g() { + Self :: f() + } +} + +fn main() { + let a: A = test::A; + let b: A = test::B; + let c: () = A::g(); +} |
