summaryrefslogtreecommitdiffstats
path: root/src/test/ui/generic-associated-types/issue-92033.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/test/ui/generic-associated-types/issue-92033.rs
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/generic-associated-types/issue-92033.rs')
-rw-r--r--src/test/ui/generic-associated-types/issue-92033.rs39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/test/ui/generic-associated-types/issue-92033.rs b/src/test/ui/generic-associated-types/issue-92033.rs
new file mode 100644
index 000000000..1d5f7d5c0
--- /dev/null
+++ b/src/test/ui/generic-associated-types/issue-92033.rs
@@ -0,0 +1,39 @@
+#![feature(generic_associated_types)]
+
+struct Texture;
+
+trait Surface {
+ type TextureIter<'a>: Iterator<Item = &'a Texture>
+ where
+ Self: 'a;
+
+ fn get_texture(&self) -> Self::TextureIter<'_>;
+}
+
+trait Swapchain {
+ type Surface<'a>: Surface
+ where
+ Self: 'a;
+
+ fn get_surface(&self) -> Self::Surface<'_>;
+}
+
+impl<'s> Surface for &'s Texture {
+ type TextureIter<'a> = std::option::IntoIter<&'a Texture>;
+ //~^ ERROR the type
+
+ fn get_texture(&self) -> Self::TextureIter<'_> {
+ let option: Option<&Texture> = Some(self);
+ option.into_iter()
+ }
+}
+
+impl Swapchain for Texture {
+ type Surface<'a> = &'a Texture;
+
+ fn get_surface(&self) -> Self::Surface<'_> {
+ self
+ }
+}
+
+fn main() {}