@@ -900,7 +900,6 @@ fn maybe_point_at_variant<'a, 'p: 'a, 'tcx: 'a>(
900900fn check_borrow_conflicts_in_at_patterns < ' tcx > ( cx : & MatchVisitor < ' _ , ' _ , ' tcx > , pat : & Pat < ' tcx > ) {
901901 // Extract `sub` in `binding @ sub`.
902902 let PatKind :: Binding { name, mode, ty, subpattern : Some ( box ref sub) , .. } = pat. kind else { return } ;
903- let binding_span = pat. span ; //.with_hi(name.span.hi());
904903
905904 let is_binding_by_move = |ty : Ty < ' tcx > | !ty. is_copy_modulo_regions ( cx. tcx , cx. param_env ) ;
906905
@@ -917,15 +916,11 @@ fn check_borrow_conflicts_in_at_patterns<'tcx>(cx: &MatchVisitor<'_, '_, 'tcx>,
917916 } ) ;
918917 if !conflicts_ref. is_empty ( ) {
919918 sess. emit_err ( BorrowOfMovedValue {
920- span : pat. span ,
921- binding_span,
919+ binding_span : pat. span ,
922920 conflicts_ref,
923921 name,
924922 ty,
925- suggest_borrowing : pat
926- . span
927- . contains ( binding_span)
928- . then ( || binding_span. shrink_to_lo ( ) ) ,
923+ suggest_borrowing : Some ( pat. span . shrink_to_lo ( ) ) ,
929924 } ) ;
930925 }
931926 return ;
@@ -967,8 +962,8 @@ fn check_borrow_conflicts_in_at_patterns<'tcx>(cx: &MatchVisitor<'_, '_, 'tcx>,
967962 let report_move_conflict = !conflicts_move. is_empty ( ) ;
968963
969964 let mut occurences = match mut_outer {
970- Mutability :: Mut => vec ! [ Conflict :: Mut { span: binding_span , name } ] ,
971- Mutability :: Not => vec ! [ Conflict :: Ref { span: binding_span , name } ] ,
965+ Mutability :: Mut => vec ! [ Conflict :: Mut { span: pat . span , name } ] ,
966+ Mutability :: Not => vec ! [ Conflict :: Ref { span: pat . span , name } ] ,
972967 } ;
973968 occurences. extend ( conflicts_mut_mut) ;
974969 occurences. extend ( conflicts_mut_ref) ;
0 commit comments