Added test to make sure we can refer to the declared traits of a generic associated type

This commit is contained in:
Sunjay Varma 2017-12-13 18:50:22 -05:00
parent 4f90eacbfe
commit b90e9c9b2c
2 changed files with 18 additions and 5 deletions

View file

@ -10,6 +10,8 @@
#![feature(generic_associated_types)]
use std::ops::Deref;
//FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a
//follow-up PR
@ -18,6 +20,11 @@ trait Iterable {
type Iter<'a>: Iterator<Item = Self::Item<'a>>;
//~^ ERROR lifetime parameters are not allowed on this type [E0110]
// This weird type tests that we can use universal function call syntax to access the Item on
// Self::Iter which we have declared to be an Iterator
type Iter2<'a>: Deref<Target = <Self::Iter<'a> as Iterator>::Item>;
//~^ ERROR lifetime parameters are not allowed on this type [E0110]
fn iter<'a>(&'a self) -> Self::Iter<'a>;
//~^ ERROR lifetime parameters are not allowed on this type [E0110]
}

View file

@ -1,14 +1,20 @@
error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/iterable.rs:18:47
--> $DIR/iterable.rs:20:47
|
18 | type Iter<'a>: Iterator<Item = Self::Item<'a>>;
20 | type Iter<'a>: Iterator<Item = Self::Item<'a>>;
| ^^ lifetime parameter not allowed on this type
error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/iterable.rs:21:41
--> $DIR/iterable.rs:25:48
|
21 | fn iter<'a>(&'a self) -> Self::Iter<'a>;
25 | type Iter2<'a>: Deref<Target = <Self::Iter<'a> as Iterator>::Item>;
| ^^ lifetime parameter not allowed on this type
error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/iterable.rs:28:41
|
28 | fn iter<'a>(&'a self) -> Self::Iter<'a>;
| ^^ lifetime parameter not allowed on this type
error: aborting due to 2 previous errors
error: aborting due to 3 previous errors