about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/example
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_codegen_cranelift/example')
-rw-r--r--compiler/rustc_codegen_cranelift/example/polymorphize_coroutine.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_cranelift/example/polymorphize_coroutine.rs b/compiler/rustc_codegen_cranelift/example/polymorphize_coroutine.rs
new file mode 100644
index 00000000000..c965b34e13b
--- /dev/null
+++ b/compiler/rustc_codegen_cranelift/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(());
+}