about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/traits
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-02-26 01:36:08 +0000
committerMichael Goulet <michael@errs.io>2024-02-26 01:36:14 +0000
commitff07f55db500dafb2d6570b5de7928bcc10a955f (patch)
treedaebfda751be49162f805358d90db6dbe9d1b984 /compiler/rustc_trait_selection/src/traits
parent6bdb8a4a96945527677f4b3dc7161875834189a4 (diff)
downloadrust-ff07f55db500dafb2d6570b5de7928bcc10a955f.tar.gz
rust-ff07f55db500dafb2d6570b5de7928bcc10a955f.zip
Actually use the right closure kind when checking async Fn goals
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits')
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/confirmation.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs
index f76be876948..d316149731e 100644
--- a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs
@@ -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"),
         };