use std::marker::PhantomData; pub trait StatefulFuture {} pub struct Never(PhantomData); impl StatefulFuture for Never {} pub struct RaceBuilder { future: F, _phantom: PhantomData, } impl RaceBuilder where F: StatefulFuture>, { pub fn when(self) {} } pub struct Race { race: R, _phantom: PhantomData, } impl Race where R: Fn(RaceBuilder>), { pub fn new(race: R) {} } fn main() { Race::new(|race| race.when()); //~ ERROR type annotations needed }