mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
aef0f4024a
And suggest adding the `#[coroutine]` to the closure
19 lines
379 B
Rust
19 lines
379 B
Rust
//@ compile-flags: -Zpolymorphize=on
|
|
//@ build-pass
|
|
|
|
#![feature(coroutines, coroutine_trait, stmt_expr_attributes)]
|
|
|
|
use std::ops::Coroutine;
|
|
use std::pin::Pin;
|
|
use std::thread;
|
|
|
|
fn main() {
|
|
let mut foo = #[coroutine]
|
|
|| yield;
|
|
thread::spawn(move || match Pin::new(&mut foo).resume(()) {
|
|
s => panic!("bad state: {:?}", s),
|
|
})
|
|
.join()
|
|
.unwrap();
|
|
}
|