Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fca50e8

Browse files
committedOct 22, 2018
Auto merge of #55221 - matthewjasper:fewer-duplicate-migrate-messages, r=pnkfelix
Don't emit cannot move errors twice in migrate mode Closes #55154 cc #53004 r? @pnkfelix
2 parents a66dc8a + b375728 commit fca50e8

File tree

43 files changed

+46
-810
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+46
-810
lines changed
 

‎src/librustc_mir/borrow_check/mod.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,7 +1831,10 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
18311831
| Write(wk @ WriteKind::StorageDeadOrDrop)
18321832
| Write(wk @ WriteKind::MutableBorrow(BorrowKind::Shared))
18331833
| Write(wk @ WriteKind::MutableBorrow(BorrowKind::Shallow)) => {
1834-
if let Err(_place_err) = self.is_mutable(place, is_local_mutation_allowed) {
1834+
if let (Err(_place_err), true) = (
1835+
self.is_mutable(place, is_local_mutation_allowed),
1836+
self.errors_buffer.is_empty()
1837+
) {
18351838
if self.infcx.tcx.migrate_borrowck() {
18361839
// rust-lang/rust#46908: In pure NLL mode this
18371840
// code path should be unreachable (and thus
@@ -1855,12 +1858,11 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
18551858
location,
18561859
);
18571860
} else {
1858-
self.infcx.tcx.sess.delay_span_bug(
1861+
span_bug!(
18591862
span,
1860-
&format!(
1861-
"Accessing `{:?}` with the kind `{:?}` shouldn't be possible",
1862-
place, kind
1863-
),
1863+
"Accessing `{:?}` with the kind `{:?}` shouldn't be possible",
1864+
place,
1865+
kind,
18641866
);
18651867
}
18661868
}

‎src/librustc_mir/borrow_check/mutability_errors.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> {
180180
AccessKind::Move => {
181181
err = self.infcx.tcx
182182
.cannot_move_out_of(span, &(item_msg + &reason), Origin::Mir);
183-
act = "move";
184-
acted_on = "moved";
185-
span
183+
err.span_label(span, "cannot move");
184+
err.buffer(&mut self.errors_buffer);
185+
return;
186186
}
187187
AccessKind::Mutate => {
188188
err = self.infcx.tcx

0 commit comments

Comments
 (0)
Please sign in to comment.