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 09b0936

Browse files
committedMay 23, 2022
Refactor call terminator to always hold a destination place
1 parent 222c572 commit 09b0936

File tree

67 files changed

+422
-412
lines changed

Some content is hidden

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

67 files changed

+422
-412
lines changed
 

‎compiler/rustc_borrowck/src/constraint_generation.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,7 @@ impl<'cg, 'cx, 'tcx> Visitor<'tcx> for ConstraintGeneration<'cg, 'cx, 'tcx> {
140140
// A `Call` terminator's return value can be a local which has borrows,
141141
// so we need to record those as `killed` as well.
142142
if let TerminatorKind::Call { destination, .. } = terminator.kind {
143-
if let Some((place, _)) = destination {
144-
self.record_killed_borrows_for_place(place, location);
145-
}
143+
self.record_killed_borrows_for_place(destination, location);
146144
}
147145

148146
self.super_terminator(terminator, location);

‎compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2198,10 +2198,10 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
21982198
"annotate_argument_and_return_for_borrow: target={:?} terminator={:?}",
21992199
target, terminator
22002200
);
2201-
if let TerminatorKind::Call { destination: Some((place, _)), args, .. } =
2201+
if let TerminatorKind::Call { destination, target: Some(_), args, .. } =
22022202
&terminator.kind
22032203
{
2204-
if let Some(assigned_to) = place.as_local() {
2204+
if let Some(assigned_to) = destination.as_local() {
22052205
debug!(
22062206
"annotate_argument_and_return_for_borrow: assigned_to={:?} args={:?}",
22072207
assigned_to, args

0 commit comments

Comments
 (0)
Please sign in to comment.