2018-09-06 12:41:12 +00:00
|
|
|
// run-pass
|
|
|
|
|
2018-06-13 07:11:23 +00:00
|
|
|
pub trait FakeGenerator {
|
|
|
|
type Yield;
|
|
|
|
type Return;
|
|
|
|
}
|
|
|
|
|
|
|
|
pub trait FakeFuture {
|
|
|
|
type Output;
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn future_from_generator<
|
|
|
|
T: FakeGenerator<Yield = ()>
|
|
|
|
>(x: T) -> impl FakeFuture<Output = T::Return> {
|
|
|
|
GenFuture(x)
|
|
|
|
}
|
|
|
|
|
2022-07-25 20:36:03 +00:00
|
|
|
struct GenFuture<T: FakeGenerator<Yield = ()>>(#[allow(unused_tuple_struct_fields)] T);
|
2018-06-13 07:11:23 +00:00
|
|
|
|
|
|
|
impl<T: FakeGenerator<Yield = ()>> FakeFuture for GenFuture<T> {
|
|
|
|
type Output = T::Return;
|
|
|
|
}
|
|
|
|
|
2018-06-13 17:10:41 +00:00
|
|
|
fn main() {}
|