@@ -900,7 +900,6 @@ fn maybe_point_at_variant<'a, 'p: 'a, 'tcx: 'a>(
900
900
fn check_borrow_conflicts_in_at_patterns<'tcx>(cx: &MatchVisitor<'_, '_, 'tcx>, pat: &Pat<'tcx>) {
901
901
// Extract `sub` in `binding @ sub`.
902
902
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());
904
903
905
904
let is_binding_by_move = |ty: Ty<'tcx>| !ty.is_copy_modulo_regions(cx.tcx, cx.param_env);
906
905
@@ -917,15 +916,11 @@ fn check_borrow_conflicts_in_at_patterns<'tcx>(cx: &MatchVisitor<'_, '_, 'tcx>,
917
916
});
918
917
if !conflicts_ref.is_empty() {
919
918
sess.emit_err(BorrowOfMovedValue {
920
- span: pat.span,
921
- binding_span,
919
+ binding_span: pat.span,
922
920
conflicts_ref,
923
921
name,
924
922
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()),
929
924
});
930
925
}
931
926
return;
@@ -967,8 +962,8 @@ fn check_borrow_conflicts_in_at_patterns<'tcx>(cx: &MatchVisitor<'_, '_, 'tcx>,
967
962
let report_move_conflict = !conflicts_move.is_empty();
968
963
969
964
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 }],
972
967
};
973
968
occurences.extend(conflicts_mut_mut);
974
969
occurences.extend(conflicts_mut_ref);
0 commit comments