about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/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
commitaa51a27f8e50d0df4db402be2d9b1f9396f6c85e (patch)
tree2d41b0c11304a7388330140d39129297ea0ec749 /compiler/rustc_codegen_cranelift/example
parente2e978f713665663c0129f935168b06c79dfbb4d (diff)
parent710c67909d034e1c663174a016ca82b95c2d6c12 (diff)
downloadrust-aa51a27f8e50d0df4db402be2d9b1f9396f6c85e.tar.gz
rust-aa51a27f8e50d0df4db402be2d9b1f9396f6c85e.zip
Merge commit '710c67909d034e1c663174a016ca82b95c2d6c12' into sync_cg_clif-2023-11-25
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(());
+}