rust/tests/ui/impl-trait/issues/issue-84073.rs

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

34 lines
570 B
Rust
Raw Normal View History

2022-02-17 07:55:58 -06:00
use std::marker::PhantomData;
pub trait StatefulFuture<S> {}
pub struct Never<T>(PhantomData<T>);
impl<T> StatefulFuture<T> for Never<T> {}
pub struct RaceBuilder<F, S> {
future: F,
_phantom: PhantomData<S>,
}
impl<T, F> RaceBuilder<T, F>
where
F: StatefulFuture<Option<T>>,
{
pub fn when(self) {}
}
pub struct Race<T, R> {
race: R,
_phantom: PhantomData<T>,
}
impl<T, R> Race<T, R>
where
R: Fn(RaceBuilder<T, Never<T>>),
{
pub fn new(race: R) {}
}
fn main() {
Race::new(|race| race.when()); //~ ERROR type annotations needed
}