Code change:
// for closures and async closures, respectively. match closure_kind { hir::ClosureKind::Closure <del> if self.tcx.fn_trait_kind_from_def_id(trait_def_id).is_some() => {} </del> <ins> if self.tcx.fn_trait_kind_from_def_id(trait_def_id).is_some() => { self.extract_sig_from_projection(cause_span, projection) } hir::ClosureKind::CoroutineClosure(hir::CoroutineDesugaring::Async) if self.tcx.async_fn_trait_kind_from_def_id(trait_def_id).is_some() => { self.extract_sig_from_projection(cause_span, projection) } // It's possible we've passed the closure to a (somewhat out-of-fashion) // `F: FnOnce() -> Fut, Fut: Future<Output = T>` style bound. Let's still // guide inference here, since it's beneficial for the user. </ins> hir::ClosureKind::CoroutineClosure(hir::CoroutineDesugaring::Async) <del> if self.tcx.async_fn_trait_kind_from_def_id(trait_def_id).is_some() => {} _ => return None, </del> <ins> if self.tcx.fn_trait_kind_from_def_id(trait_def_id).is_some() => { self.extract_sig_from_projection_and_future_bound(cause_span, projection) } _ => None, </ins> } <ins> } /// Given an `FnOnce::Output` or `AsyncFn::Output` projection, extract the args /// and return type to infer a [`ty::PolyFnSig`] for the closure. fn extract_sig_from_projection( &self, cause_span: Option<Span>, projection: ty::PolyProjectionPredicate<'tcx>, ) -> Option<ExpectedSig<'tcx>> { let projection = self.resolve_vars_if_possible(projection); </ins> let arg_param_ty = projection.skip_binder().projection_term.args.type_at(1); <del> let arg_param_ty = self.resolve_vars_if_possible(arg_param_ty); </del> debug!(?arg_param_ty); let ty::Tuple(input_tys) = *arg_param_ty.kind() else {

Related discussion:
text: When using async closures, rust since around 1.80 fails to infer parameter type in most scenarios. I expected to see this happen: All options used to work in past versions of rust Instead, this happened: Without explicit type hint it fails It used to work in the past, around 1.79
We don't typically mark nightly features with labels, so I'm removing those. Are you certain this regressed in 1.80? This should have regressed in , when I reimplemented async closures completely.
I am not 100% sure when it happened. I used to work with 1.7x a couple of months ago. Then I left my project for a moment. When I came back, after updating to 1.81 it no longer works. IIRC before leaving it was around 1.79, but I'm not sure.
This limitation to async closure signature inference has to do with the fact that the combinators you're using (e.g. ) take regular trait bounds. Is there a particular reason you're using async closures here? They're really not gaining you anything other than a dependency on the nightly compiler.
I posted a minimal example, indeed async does not make much sense here, but in project I work on it does. As a workaround I've just annotated parameters with original types, but I still believe this is a bug.
This indeed regressed in .
While the problem from first message in issue seems to be fixed, there are still cases when this fails. One of examples is when using instead of , when closure is expected to return : Should I open new issue, or this one will be reopened?
Please open a new issue, since it's likely a different root cause