//@ check-pass use std::ops::Add; trait Trait { fn get(self) -> T; } struct Holder(T); impl Trait for Holder { fn get(self) -> T { self.0 } } enum Either { Left(L), Right(R), } impl Either { fn converge(self) -> T where L: Trait, R: Trait, { match self { Either::Left(val) => val.get(), Either::Right(val) => val.get(), } } } fn add_generic, B>( lhs: A, rhs: B, ) -> Either>::Output>, impl Trait<>::Output>> { if true { Either::Left(Holder(lhs + rhs)) } else { Either::Right(Holder(lhs + rhs)) } } fn add_one( value: u32, ) -> Either>::Output>, impl Trait<>::Output>> { add_generic(value, 1u32) } pub fn main() { add_one(3).converge(); }