diff options
| author | Kevin Butler <haqkrs@gmail.com> | 2014-05-23 20:51:21 +0100 |
|---|---|---|
| committer | Kevin Butler <haqkrs@gmail.com> | 2014-05-23 20:51:21 +0100 |
| commit | da663ccf9f9bcc737d63ee48515689bd2b40ef3d (patch) | |
| tree | 29a89758503a72cd6bf53aa372acd9a180ad5c04 /src/test | |
| parent | ad775be8b48f82d19356942a4fc6fcadc56d3e7e (diff) | |
| download | rust-da663ccf9f9bcc737d63ee48515689bd2b40ef3d.tar.gz rust-da663ccf9f9bcc737d63ee48515689bd2b40ef3d.zip | |
Improve error message for lifetimes after type params.
Closes #14303.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/issue-14303-enum.rs | 14 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-14303-fn-def.rs | 12 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-14303-fncall.rs | 16 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-14303-impl.rs | 14 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-14303-path.rs | 12 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-14303-struct.rs | 14 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-14303-trait.rs | 12 |
7 files changed, 94 insertions, 0 deletions
diff --git a/src/test/compile-fail/issue-14303-enum.rs b/src/test/compile-fail/issue-14303-enum.rs new file mode 100644 index 00000000000..a26b7fdc425 --- /dev/null +++ b/src/test/compile-fail/issue-14303-enum.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. + +enum X<'a, T, 'b> { +//~^ ERROR lifetime parameters must be declared prior to type parameters + A(&'a T) +} diff --git a/src/test/compile-fail/issue-14303-fn-def.rs b/src/test/compile-fail/issue-14303-fn-def.rs new file mode 100644 index 00000000000..aaf95410b8e --- /dev/null +++ b/src/test/compile-fail/issue-14303-fn-def.rs @@ -0,0 +1,12 @@ +// 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. + +fn foo<'a, T, 'b>(x: &'a T) {} +//~^ ERROR lifetime parameters must be declared prior to type parameters diff --git a/src/test/compile-fail/issue-14303-fncall.rs b/src/test/compile-fail/issue-14303-fncall.rs new file mode 100644 index 00000000000..3a5c8bbc546 --- /dev/null +++ b/src/test/compile-fail/issue-14303-fncall.rs @@ -0,0 +1,16 @@ +// 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. + +fn main() { + range(0, 4) + .map(|x| x * 2) + .collect::<Vec<'a, uint, 'b>>() + //~^ ERROR lifetime parameters must be declared prior to type parameters +} diff --git a/src/test/compile-fail/issue-14303-impl.rs b/src/test/compile-fail/issue-14303-impl.rs new file mode 100644 index 00000000000..46d0219da81 --- /dev/null +++ b/src/test/compile-fail/issue-14303-impl.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. + +struct X { x: int } + +impl<'a, T, 'b> X {} +//~^ ERROR lifetime parameters must be declared prior to type parameters diff --git a/src/test/compile-fail/issue-14303-path.rs b/src/test/compile-fail/issue-14303-path.rs new file mode 100644 index 00000000000..30cc41c3588 --- /dev/null +++ b/src/test/compile-fail/issue-14303-path.rs @@ -0,0 +1,12 @@ +// 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. + +fn bar<'a, T>(x: mymodule::X<'a, T, 'b, 'c>) {} +//~^ ERROR lifetime parameters must be declared prior to type parameters diff --git a/src/test/compile-fail/issue-14303-struct.rs b/src/test/compile-fail/issue-14303-struct.rs new file mode 100644 index 00000000000..6edd808d847 --- /dev/null +++ b/src/test/compile-fail/issue-14303-struct.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. + +struct X<'a, T, 'b> { +//~^ ERROR lifetime parameters must be declared prior to type parameters + x: &'a T +} diff --git a/src/test/compile-fail/issue-14303-trait.rs b/src/test/compile-fail/issue-14303-trait.rs new file mode 100644 index 00000000000..753acdd75fe --- /dev/null +++ b/src/test/compile-fail/issue-14303-trait.rs @@ -0,0 +1,12 @@ +// 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. + +trait Foo<'a, T, 'b> {} +//~^ ERROR lifetime parameters must be declared prior to type parameters |
