Skip to content

Commit cd03f5d

Browse files
committed
mir/borrowck: deduplicate assignments and returns
1 parent 684c4e8 commit cd03f5d

File tree

1 file changed

+2
-6
lines changed
  • src/librustc_mir/borrow_check

1 file changed

+2
-6
lines changed

src/librustc_mir/borrow_check/mod.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -1009,13 +1009,12 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
10091009
return Control::Continue;
10101010
}
10111011

1012+
error_reported = true;
10121013
match kind {
10131014
ReadKind::Copy => {
1014-
error_reported = true;
10151015
this.report_use_while_mutably_borrowed(context, place_span, borrow)
10161016
}
10171017
ReadKind::Borrow(bk) => {
1018-
error_reported = true;
10191018
this.report_conflicting_borrow(context, place_span, bk, &borrow)
10201019
}
10211020
}
@@ -1045,25 +1044,22 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
10451044
Read(..) | Write(..) => {}
10461045
}
10471046

1047+
error_reported = true;
10481048
match kind {
10491049
WriteKind::MutableBorrow(bk) => {
1050-
error_reported = true;
10511050
this.report_conflicting_borrow(context, place_span, bk, &borrow)
10521051
}
10531052
WriteKind::StorageDeadOrDrop => {
1054-
error_reported = true;
10551053
this.report_borrowed_value_does_not_live_long_enough(
10561054
context,
10571055
borrow,
10581056
place_span,
10591057
Some(kind))
10601058
}
10611059
WriteKind::Mutate => {
1062-
error_reported = true;
10631060
this.report_illegal_mutation_of_borrowed(context, place_span, borrow)
10641061
}
10651062
WriteKind::Move => {
1066-
error_reported = true;
10671063
this.report_move_out_while_borrowed(context, place_span, &borrow)
10681064
}
10691065
}

0 commit comments

Comments
 (0)