about summary refs log tree commit diff
path: root/example
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2023-11-25 10:05:52 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2023-11-25 10:05:52 +0000
commit1988cf4a18f9c0d2a3fd6ebced72190a600f247f (patch)
treed483f8c24224544ff1af4f38e27abc3e2e40e44c /example
parent4ae658683f87b0f34ffb5c06f50ca1c51333a1a4 (diff)
downloadrust-1988cf4a18f9c0d2a3fd6ebced72190a600f247f.tar.gz
rust-1988cf4a18f9c0d2a3fd6ebced72190a600f247f.zip
Merge commit '710c67909d034e1c663174a016ca82b95c2d6c12' into sync_cg_clif-2023-11-25
Diffstat (limited to 'example')
-rw-r--r--example/polymorphize_coroutine.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/example/polymorphize_coroutine.rs b/example/polymorphize_coroutine.rs
new file mode 100644
index 00000000000..c965b34e13b
--- /dev/null
+++ b/example/polymorphize_coroutine.rs
@@ -0,0 +1,16 @@
+#![feature(coroutines, coroutine_trait)]
+
+use std::ops::Coroutine;
+use std::pin::Pin;
+
+fn main() {
+    run_coroutine::<i32>();
+}
+
+fn run_coroutine<T>() {
+    let mut coroutine = || {
+        yield;
+        return;
+    };
+    Pin::new(&mut coroutine).resume(());
+}