Skip to content

Commit e73aeea

Browse files
committed
Remove redundant field.
1 parent 4f97540 commit e73aeea

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

compiler/rustc_mir_build/src/errors.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,6 @@ pub struct IrrefutableLetPatternsWhileLet {
576576
#[diag(mir_build_borrow_of_moved_value)]
577577
pub struct BorrowOfMovedValue<'tcx> {
578578
#[primary_span]
579-
pub span: Span,
580579
#[label]
581580
#[label(mir_build_occurs_because_label)]
582581
pub binding_span: Span,

compiler/rustc_mir_build/src/thir/pattern/check_match.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,6 @@ fn maybe_point_at_variant<'a, 'p: 'a, 'tcx: 'a>(
900900
fn 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

Comments
 (0)