@@ -596,9 +596,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
596596 self . add_move_error_details ( err, & binds_to) ;
597597 }
598598 // No binding. Nothing to suggest.
599- GroupedMoveError :: OtherIllegalMove {
600- ref original_path, use_spans, ref kind, ..
601- } => {
599+ GroupedMoveError :: OtherIllegalMove { ref original_path, use_spans, .. } => {
602600 let mut use_span = use_spans. var_or_use ( ) ;
603601 let place_ty = original_path. ty ( self . body , self . infcx . tcx ) . ty ;
604602 let place_desc = match self . describe_place ( original_path. as_ref ( ) ) {
@@ -616,14 +614,11 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
616614 ) ;
617615 }
618616
619- if let IllegalMoveOriginKind :: BorrowedContent { target_place } = & kind
620- && let ty = target_place. ty ( self . body , self . infcx . tcx ) . ty
621- && let ty:: Closure ( def_id, _) = ty. kind ( )
622- && def_id. as_local ( ) == Some ( self . mir_def_id ( ) )
623- && let Some ( upvar_field) = self
624- . prefixes ( original_path. as_ref ( ) , PrefixSet :: All )
625- . find_map ( |p| self . is_upvar_field_projection ( p) )
617+ if let Some ( upvar_field) = self
618+ . prefixes ( original_path. as_ref ( ) , PrefixSet :: All )
619+ . find_map ( |p| self . is_upvar_field_projection ( p) )
626620 {
621+ // Look for the introduction of the original binding being moved.
627622 let upvar = & self . upvars [ upvar_field. index ( ) ] ;
628623 let upvar_hir_id = upvar. get_root_variable ( ) ;
629624 use_span = match self . infcx . tcx . parent_hir_node ( upvar_hir_id) {
0 commit comments