2 #![feature(generic_associated_types)]
4 // @has foo/trait.LendingIterator.html
5 pub trait LendingIterator {
6 // @has - '//*[@id="associatedtype.Item"]//h4[@class="code-header"]' "type Item<'a> where Self: 'a"
7 type Item<'a> where Self: 'a;
9 // @has - '//*[@id="tymethod.next"]//h4[@class="code-header"]' \
10 // "fn next<'a>(&'a self) -> Self::Item<'a>"
11 // @has - '//*[@id="tymethod.next"]//h4[@class="code-header"]//a[@href="trait.LendingIterator.html#associatedtype.Item"]' \
13 fn next<'a>(&'a self) -> Self::Item<'a>;
16 // @has foo/trait.LendingIterator.html
17 // @has - '//*[@id="associatedtype.Item-1"]//h4[@class="code-header"]' "type Item<'a> = ()"
18 impl LendingIterator for () {
21 fn next<'a>(&self) -> () {}
24 pub struct Infinite<T>(T);
26 // @has foo/trait.LendingIterator.html
27 // @has - '//*[@id="associatedtype.Item-2"]//h4[@class="code-header"]' "type Item<'a> where Self: 'a = &'a T"
28 impl<T> LendingIterator for Infinite<T> {
29 type Item<'a> where Self: 'a = &'a T;
31 fn next<'a>(&'a self) -> Self::Item<'a> {