rust/tests/ui/impl-trait/bounds_regression.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
433 B
Rust
Raw Normal View History

//@ run-pass
2023-10-19 16:06:43 +00:00
pub trait FakeCoroutine {
2018-06-13 07:11:23 +00:00
type Yield;
type Return;
}
pub trait FakeFuture {
type Output;
}
2023-10-19 21:46:28 +00:00
pub fn future_from_coroutine<
2023-10-19 16:06:43 +00:00
T: FakeCoroutine<Yield = ()>
2018-06-13 07:11:23 +00:00
>(x: T) -> impl FakeFuture<Output = T::Return> {
GenFuture(x)
}
struct GenFuture<T: FakeCoroutine<Yield = ()>>(#[allow(dead_code)] T);
2018-06-13 07:11:23 +00:00
2023-10-19 16:06:43 +00:00
impl<T: FakeCoroutine<Yield = ()>> FakeFuture for GenFuture<T> {
2018-06-13 07:11:23 +00:00
type Output = T::Return;
}
2018-06-13 17:10:41 +00:00
fn main() {}