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)]
12 //~^ WARNING the feature `generic_associated_types` is incomplete
16 // FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a
21 type Iter<'a>: Iterator<Item = Self::Item<'a>>;
22 //~^ ERROR lifetime parameters are not allowed on this type [E0110]
24 fn iter<'a>(&'a self) -> Self::Iter<'a>;
25 //~^ ERROR lifetime parameters are not allowed on this type [E0110]
28 // Impl for struct type
29 impl<T> Iterable for Vec<T> {
30 type Item<'a> = &'a T;
31 type Iter<'a> = std::slice::Iter<'a, T>;
33 fn iter<'a>(&'a self) -> Self::Iter<'a> {
34 //~^ ERROR lifetime parameters are not allowed on this type [E0110]
39 // Impl for a primitive type
40 impl<T> Iterable for [T] {
41 type Item<'a> = &'a T;
42 type Iter<'a> = std::slice::Iter<'a, T>;
44 fn iter<'a>(&'a self) -> Self::Iter<'a> {
45 //~^ ERROR lifetime parameters are not allowed on this type [E0110]
50 fn make_iter<'a, I: Iterable>(it: &'a I) -> I::Iter<'a> {
51 //~^ ERROR lifetime parameters are not allowed on this type [E0110]
55 fn get_first<'a, I: Iterable>(it: &'a I) -> Option<I::Item<'a>> {
56 //~^ ERROR lifetime parameters are not allowed on this type [E0110]