1
Fork 0

Actually use the right closure kind when checking async Fn goals

This commit is contained in:
Michael Goulet 2024-02-26 01:36:08 +00:00
parent 6bdb8a4a96
commit ff07f55db5
3 changed files with 33 additions and 7 deletions

View file

@ -934,7 +934,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
(trait_ref, Ty::from_closure_kind(tcx, ty::ClosureKind::Fn))
}
ty::Closure(_, args) => {
let sig = args.as_closure().sig();
let args = args.as_closure();
let sig = args.sig();
let trait_ref = sig.map_bound(|sig| {
ty::TraitRef::new(
self.tcx(),
@ -950,7 +951,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
ty::TraitRef::new(tcx, future_trait_def_id, [sig.output()])
}),
));
(trait_ref, Ty::from_closure_kind(tcx, ty::ClosureKind::Fn))
(trait_ref, args.kind_ty())
}
_ => bug!("expected callable type for AsyncFn candidate"),
};