rust/tests/ui/generator/auxiliary/xcrate.rs

19 lines
349 B
Rust
Raw Normal View History

2018-03-22 01:32:44 +00:00
#![feature(generators, generator_trait)]
2016-12-26 13:34:03 +00:00
2018-10-04 18:49:38 +00:00
use std::marker::Unpin;
2017-08-09 20:56:19 +00:00
use std::ops::Generator;
pub fn foo() -> impl Generator<(), Yield = (), Return = ()> {
2017-08-09 20:56:19 +00:00
|| {
2017-08-09 23:38:05 +00:00
if false {
2017-08-09 20:56:19 +00:00
yield;
}
}
2017-07-11 19:57:05 +00:00
}
2017-08-09 23:38:05 +00:00
pub fn bar<T: 'static>(t: T) -> Box<Generator<(), Yield = T, Return = ()> + Unpin> {
2017-08-09 23:38:05 +00:00
Box::new(|| {
yield t;
})
}