//@ revisions: current next //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver //@ check-pass // Checks that we can infer a closure signature even if the `FnOnce` bound is // a supertrait of the obligations we have currently registered for the Ty var. pub trait Receive: FnOnce(Result) { fn receive(self, res: Result); } impl)> Receive for F { fn receive(self, res: Result) { self(res) } } pub trait Async { fn receive>(self, f: F); } impl Async for Result { fn receive>(self, f: F) { f(self) } } pub fn main() { Ok::(123).receive(|res| { res.unwrap(); }); }