2018-09-06 07:41:12 -05:00
|
|
|
// run-pass
|
|
|
|
|
2018-06-13 02:11:23 -05: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 15:36:03 -05:00
|
|
|
struct GenFuture<T: FakeGenerator<Yield = ()>>(#[allow(unused_tuple_struct_fields)] T);
|
2018-06-13 02:11:23 -05:00
|
|
|
|
|
|
|
impl<T: FakeGenerator<Yield = ()>> FakeFuture for GenFuture<T> {
|
|
|
|
type Output = T::Return;
|
|
|
|
}
|
|
|
|
|
2018-06-13 12:10:41 -05:00
|
|
|
fn main() {}
|