about summary refs log tree commit diff
path: root/tests/ui/impl-trait/recursive-coroutine.rs
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-10-20 10:06:08 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-10-20 21:14:02 +0000
commitaf93c20c06ec1f577f0544aaf98403a5d9ff143c (patch)
treedd842369fca071446310a3d20357b657ffbf22e5 /tests/ui/impl-trait/recursive-coroutine.rs
parent8c66e117e23326cb5f3f3565669fcb1012b54373 (diff)
downloadrust-af93c20c06ec1f577f0544aaf98403a5d9ff143c.tar.gz
rust-af93c20c06ec1f577f0544aaf98403a5d9ff143c.zip
Rename lots of files that had `generator` in their name
Diffstat (limited to 'tests/ui/impl-trait/recursive-coroutine.rs')
-rw-r--r--tests/ui/impl-trait/recursive-coroutine.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/recursive-coroutine.rs b/tests/ui/impl-trait/recursive-coroutine.rs
new file mode 100644
index 00000000000..6351cef95a6
--- /dev/null
+++ b/tests/ui/impl-trait/recursive-coroutine.rs
@@ -0,0 +1,22 @@
+#![feature(coroutines, coroutine_trait)]
+
+use std::ops::{Coroutine, CoroutineState};
+
+fn foo() -> impl Coroutine<Yield = (), Return = ()> {
+    //~^ ERROR cannot resolve opaque type
+    //~| NOTE recursive opaque type
+    //~| NOTE in this expansion of desugaring of
+    || {
+        let mut gen = Box::pin(foo());
+        //~^ NOTE coroutine captures itself here
+        let mut r = gen.as_mut().resume(());
+        while let CoroutineState::Yielded(v) = r {
+            yield v;
+            r = gen.as_mut().resume(());
+        }
+    }
+}
+
+fn main() {
+    foo();
+}