mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 17:24:06 +00:00
18 lines
340 B
Rust
18 lines
340 B
Rust
//@ compile-flags: -Zpolymorphize=on
|
|
//@ build-pass
|
|
|
|
#![feature(coroutines, coroutine_trait)]
|
|
|
|
use std::ops::Coroutine;
|
|
use std::pin::Pin;
|
|
use std::thread;
|
|
|
|
fn main() {
|
|
let mut foo = || yield;
|
|
thread::spawn(move || match Pin::new(&mut foo).resume(()) {
|
|
s => panic!("bad state: {:?}", s),
|
|
})
|
|
.join()
|
|
.unwrap();
|
|
}
|