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