]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generic-associated-types/issue-92033.rs
Auto merge of #101629 - compiler-errors:issue-101623, r=sanxiyn
[rust.git] / src / test / ui / generic-associated-types / issue-92033.rs
1 struct Texture;
2
3 trait Surface {
4     type TextureIter<'a>: Iterator<Item = &'a Texture>
5     where
6         Self: 'a;
7
8     fn get_texture(&self) -> Self::TextureIter<'_>;
9 }
10
11 trait Swapchain {
12     type Surface<'a>: Surface
13     where
14         Self: 'a;
15
16     fn get_surface(&self) -> Self::Surface<'_>;
17 }
18
19 impl<'s> Surface for &'s Texture {
20     type TextureIter<'a> = std::option::IntoIter<&'a Texture>;
21     //~^ ERROR the type
22
23     fn get_texture(&self) -> Self::TextureIter<'_> {
24         let option: Option<&Texture> = Some(self);
25         option.into_iter()
26     }
27 }
28
29 impl Swapchain for Texture {
30     type Surface<'a> = &'a Texture;
31
32     fn get_surface(&self) -> Self::Surface<'_> {
33         self
34     }
35 }
36
37 fn main() {}