diff --git a/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs b/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs index 5d154cc7b9050..47fcdd390e0ee 100644 --- a/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs +++ b/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs @@ -211,6 +211,7 @@ impl<'tcx> BorrowExplanation<'tcx> { // Otherwise, just report the whole type (and use // the intentionally fuzzy phrase "destructor") ty::Closure(..) => ("destructor", "closure".to_owned()), + ty::CoroutineClosure(..) => ("destructor", "async closure".to_owned()), ty::Coroutine(..) => ("destructor", "coroutine".to_owned()), _ => ("destructor", format!("type `{}`", local_decl.ty)), diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs index 825aa37065e15..c76a347af03a2 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs @@ -486,8 +486,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if let traits::FulfillmentErrorCode::Select(traits::SelectionError::SignatureMismatch( traits::SignatureMismatchData { expected_trait_ref, .. }, )) = error.code - && let ty::Closure(def_id, _) | ty::Coroutine(def_id, ..) = - expected_trait_ref.self_ty().kind() + && let ty::Closure(def_id, _) + | ty::CoroutineClosure(def_id, _) + | ty::Coroutine(def_id, ..) = expected_trait_ref.self_ty().kind() && span.overlaps(self.tcx.def_span(*def_id)) { true