-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Don't emit cannot move errors twice in migrate mode #55221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1831,7 +1831,10 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { | |
| Write(wk @ WriteKind::StorageDeadOrDrop) | ||
| Write(wk @ WriteKind::MutableBorrow(BorrowKind::Shared)) | ||
| Write(wk @ WriteKind::MutableBorrow(BorrowKind::Shallow)) => { | ||
if let Err(_place_err) = self.is_mutable(place, is_local_mutation_allowed) { | ||
if let (Err(_place_err), true) = ( | ||
self.is_mutable(place, is_local_mutation_allowed), | ||
self.errors_buffer.is_empty() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just to be clear: this filter is going to affect more than just the migrate mode, right? that is, I assume this will also cause us to stop emitting some move errors even in normal NLL mode? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or rather ... I guess it will stop us ... from ICE'ing in some scenarios under normal NLL mode if we've emitted an error already ...? I don't know how I feel about that. I guess its fine. |
||
) { | ||
if self.infcx.tcx.migrate_borrowck() { | ||
// rust-lang/rust#46908: In pure NLL mode this | ||
// code path should be unreachable (and thus | ||
|
@@ -1855,12 +1858,11 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { | |
location, | ||
); | ||
} else { | ||
self.infcx.tcx.sess.delay_span_bug( | ||
span_bug!( | ||
span, | ||
&format!( | ||
"Accessing `{:?}` with the kind `{:?}` shouldn't be possible", | ||
place, kind | ||
), | ||
"Accessing `{:?}` with the kind `{:?}` shouldn't be possible", | ||
place, | ||
kind, | ||
); | ||
} | ||
} | ||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah great idea to let the ICE through if we have already signaled errors. Or at least I hope it’s a great idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(ugh I clearly misread the code 3 hours ago.)