From 65ccf24ce8e51b199d60d06ad41ea35f4cdee15c Mon Sep 17 00:00:00 2001 From: Agustin Chiappe Berrini Date: Wed, 6 Dec 2017 04:28:01 -0500 Subject: and refactor to just move the checking --- src/test/compile-fail/issue-10412.rs | 32 ++++++++++++++++++++++++++ src/test/compile-fail/issue-46311.rs | 14 ++++++++++++ src/test/compile-fail/lifetime-no-keyword.rs | 16 +++++++++++++ src/test/parse-fail/issue-10412.rs | 34 ---------------------------- src/test/parse-fail/lifetime-no-keyword.rs | 18 --------------- 5 files changed, 62 insertions(+), 52 deletions(-) create mode 100644 src/test/compile-fail/issue-10412.rs create mode 100644 src/test/compile-fail/issue-46311.rs create mode 100644 src/test/compile-fail/lifetime-no-keyword.rs delete mode 100644 src/test/parse-fail/issue-10412.rs delete mode 100644 src/test/parse-fail/lifetime-no-keyword.rs (limited to 'src/test') diff --git a/src/test/compile-fail/issue-10412.rs b/src/test/compile-fail/issue-10412.rs new file mode 100644 index 00000000000..20421bfc7c4 --- /dev/null +++ b/src/test/compile-fail/issue-10412.rs @@ -0,0 +1,32 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +trait Serializable<'self, T> { //~ ERROR lifetimes cannot use keyword names + fn serialize(val : &'self T) -> Vec ; + fn deserialize(repr : &[u8]) -> &'self T; +} + +impl<'self> Serializable for &'self str { + //~^ ERROR lifetimes cannot use keyword names + //~| ERROR missing lifetime specifier + fn serialize(val : &'self str) -> Vec { + vec![1] + } + fn deserialize(repr: &[u8]) -> &'self str { + "hi" + } +} + +fn main() { + println!("hello"); + let x = "foo".to_string(); + let y = x; + println!("{}", y); +} diff --git a/src/test/compile-fail/issue-46311.rs b/src/test/compile-fail/issue-46311.rs new file mode 100644 index 00000000000..82f55f2c142 --- /dev/null +++ b/src/test/compile-fail/issue-46311.rs @@ -0,0 +1,14 @@ +// Copyright 2012-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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + 'break: loop { //~ ERROR invalid label name `'break` + } +} diff --git a/src/test/compile-fail/lifetime-no-keyword.rs b/src/test/compile-fail/lifetime-no-keyword.rs new file mode 100644 index 00000000000..e2465663dd0 --- /dev/null +++ b/src/test/compile-fail/lifetime-no-keyword.rs @@ -0,0 +1,16 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn foo<'a>(a: &'a isize) { } +fn bar(a: &'static isize) { } +fn baz<'let>(a: &'let isize) { } //~ ERROR lifetimes cannot use keyword names +fn zab<'self>(a: &'self isize) { } //~ ERROR lifetimes cannot use keyword names + +fn main() { } diff --git a/src/test/parse-fail/issue-10412.rs b/src/test/parse-fail/issue-10412.rs deleted file mode 100644 index d723d94c02c..00000000000 --- a/src/test/parse-fail/issue-10412.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error - - -trait Serializable<'self, T> { //~ ERROR lifetimes cannot use keyword names - fn serialize(val : &'self T) -> Vec ; //~ ERROR lifetimes cannot use keyword names - fn deserialize(repr : &[u8]) -> &'self T; //~ ERROR lifetimes cannot use keyword names -} - -impl<'self> Serializable for &'self str { //~ ERROR lifetimes cannot use keyword names - //~^ ERROR lifetimes cannot use keyword names - fn serialize(val : &'self str) -> Vec { //~ ERROR lifetimes cannot use keyword names - vec![1] - } - fn deserialize(repr: &[u8]) -> &'self str { //~ ERROR lifetimes cannot use keyword names - "hi" - } -} - -fn main() { - println!("hello"); - let x = "foo".to_string(); - let y = x; - println!("{}", y); -} diff --git a/src/test/parse-fail/lifetime-no-keyword.rs b/src/test/parse-fail/lifetime-no-keyword.rs deleted file mode 100644 index a8771ae93af..00000000000 --- a/src/test/parse-fail/lifetime-no-keyword.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error - -fn foo<'a>(a: &'a isize) { } -fn bar(a: &'static isize) { } -fn baz(a: &'let isize) { } //~ ERROR lifetimes cannot use keyword names -fn zab(a: &'self isize) { } //~ ERROR lifetimes cannot use keyword names - -fn main() { } -- cgit 1.4.1-3-g733a5