mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
25 lines
449 B
Rust
25 lines
449 B
Rust
// run-pass
|
|
|
|
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)
|
|
}
|
|
|
|
struct GenFuture<T: FakeGenerator<Yield = ()>>(#[allow(unused_tuple_struct_fields)] T);
|
|
|
|
impl<T: FakeGenerator<Yield = ()>> FakeFuture for GenFuture<T> {
|
|
type Output = T::Return;
|
|
}
|
|
|
|
fn main() {}
|