diff options
| author | ljedrz <ljedrz@gmail.com> | 2018-10-16 15:13:11 +0200 |
|---|---|---|
| committer | ljedrz <ljedrz@gmail.com> | 2018-10-17 14:40:47 +0200 |
| commit | cd03f5d1e06227261b310790d4a4d6a24002f1bd (patch) | |
| tree | 5033abe5cbb851092025a80523a53eff6d58b8aa | |
| parent | 684c4e8419ae737fa2e1bc4a43961e3a5daa7c3a (diff) | |
| download | rust-cd03f5d1e06227261b310790d4a4d6a24002f1bd.tar.gz rust-cd03f5d1e06227261b310790d4a4d6a24002f1bd.zip | |
mir/borrowck: deduplicate assignments and returns
| -rw-r--r-- | src/librustc_mir/borrow_check/mod.rs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index 59bb534881e..ce0cc20f6de 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -1009,13 +1009,12 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { return Control::Continue; } + error_reported = true; match kind { ReadKind::Copy => { - error_reported = true; this.report_use_while_mutably_borrowed(context, place_span, borrow) } ReadKind::Borrow(bk) => { - error_reported = true; this.report_conflicting_borrow(context, place_span, bk, &borrow) } } @@ -1045,13 +1044,12 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { Read(..) | Write(..) => {} } + error_reported = true; match kind { WriteKind::MutableBorrow(bk) => { - error_reported = true; this.report_conflicting_borrow(context, place_span, bk, &borrow) } WriteKind::StorageDeadOrDrop => { - error_reported = true; this.report_borrowed_value_does_not_live_long_enough( context, borrow, @@ -1059,11 +1057,9 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { Some(kind)) } WriteKind::Mutate => { - error_reported = true; this.report_illegal_mutation_of_borrowed(context, place_span, borrow) } WriteKind::Move => { - error_reported = true; this.report_move_out_while_borrowed(context, place_span, &borrow) } } |
