1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 #![feature(generic_associated_types)]
15 //FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a
20 type Iter<'a>: Iterator<Item = Self::Item<'a>>;
21 //~^ ERROR lifetime parameters are not allowed on this type [E0110]
23 fn iter<'a>(&'a self) -> Self::Iter<'a>;
24 //~^ ERROR lifetime parameters are not allowed on this type [E0110]
27 // Impl for struct type
28 impl<T> Iterable for Vec<T> {
29 type Item<'a> = &'a T;
30 type Iter<'a> = std::slice::Iter<'a, T>;
32 fn iter<'a>(&'a self) -> Self::Iter<'a> {
33 //~^ ERROR lifetime parameters are not allowed on this type [E0110]
38 // Impl for a primitive type
39 impl<T> Iterable for [T] {
40 type Item<'a> = &'a T;
41 type Iter<'a> = std::slice::Iter<'a, T>;
43 fn iter<'a>(&'a self) -> Self::Iter<'a> {
44 //~^ ERROR lifetime parameters are not allowed on this type [E0110]
49 fn make_iter<'a, I: Iterable>(it: &'a I) -> I::Iter<'a> {
50 //~^ ERROR lifetime parameters are not allowed on this type [E0110]
54 fn get_first<'a, I: Iterable>(it: &'a I) -> Option<I::Item<'a>> {
55 //~^ ERROR lifetime parameters are not allowed on this type [E0110]