@@ -67,7 +67,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
6767 local,
6868 projection : [ proj_base @ .., ProjectionElem :: Field ( upvar_index, _) ] ,
6969 } => {
70- debug_assert ! ( is_closure_or_coroutine (
70+ debug_assert ! ( is_closure_like (
7171 Place :: ty_from( local, proj_base, self . body, self . infcx. tcx) . ty
7272 ) ) ;
7373
@@ -126,9 +126,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
126126 {
127127 item_msg = access_place_desc;
128128 debug_assert ! ( self . body. local_decls[ ty:: CAPTURE_STRUCT_LOCAL ] . ty. is_ref( ) ) ;
129- debug_assert ! ( is_closure_or_coroutine(
130- the_place_err. ty( self . body, self . infcx. tcx) . ty
131- ) ) ;
129+ debug_assert ! ( is_closure_like( the_place_err. ty( self . body, self . infcx. tcx) . ty) ) ;
132130
133131 reason = if self . is_upvar_field_projection ( access_place. as_ref ( ) ) . is_some ( ) {
134132 ", as it is a captured variable in a `Fn` closure" . to_string ( )
@@ -389,7 +387,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
389387 local,
390388 projection : [ proj_base @ .., ProjectionElem :: Field ( upvar_index, _) ] ,
391389 } => {
392- debug_assert ! ( is_closure_or_coroutine (
390+ debug_assert ! ( is_closure_like (
393391 Place :: ty_from( local, proj_base, self . body, self . infcx. tcx) . ty
394392 ) ) ;
395393
@@ -1474,7 +1472,8 @@ fn suggest_ampmut<'tcx>(
14741472 }
14751473}
14761474
1477- fn is_closure_or_coroutine ( ty : Ty < ' _ > ) -> bool {
1475+ /// If the type is a `Coroutine`, `Closure`, or `CoroutineClosure`
1476+ fn is_closure_like ( ty : Ty < ' _ > ) -> bool {
14781477 ty. is_closure ( ) || ty. is_coroutine ( ) || ty. is_coroutine_closure ( )
14791478}
14801479
0 commit comments