// Repro for . //@ edition: 2021 //@ revisions: assumptions no_assumptions //@[assumptions] compile-flags: -Zhigher-ranked-assumptions //@[assumptions] check-pass //@[no_assumptions] known-bug: #110338 use std::any::Any; use std::fmt; use std::future::Future; pub trait Foo { type Item; } impl Foo for F where Self: FnOnce() -> I, I: fmt::Debug, { type Item = I; } async fn foo_item(_: F) -> F::Item { unimplemented!() } fn main() { let fut = async { let callback = || -> Box { unimplemented!() }; // Using plain fn instead of a closure fixes the error, // though you obviously can't capture any state... // fn callback() -> Box { // todo!() // } foo_item(callback).await; }; // Removing `+ Send` bound also fixes the error, // though at the cost of loosing `Send`ability... let fut: &(dyn Future + Send) = &fut as _; }