Refactor call terminator to always hold a destination place

This commit is contained in:
Jakob Degen 2022-04-16 09:27:54 -04:00
parent 77d2b10050
commit 0684d62b56
2 changed files with 3 additions and 2 deletions

View File

@ -292,7 +292,7 @@ fn is_call_with_ref_arg<'tcx>(
if let (inner_ty, 1) = walk_ptrs_ty_depth(args[0].ty(&*mir, cx.tcx));
if !is_copy(cx, inner_ty);
then {
Some((def_id, *local, inner_ty, destination.as_ref().map(|(dest, _)| dest)?.as_local()?))
Some((def_id, *local, inner_ty, destination.as_local()?))
} else {
None
}
@ -584,7 +584,7 @@ impl<'a, 'tcx> mir::visit::Visitor<'tcx> for PossibleBorrowerVisitor<'a, 'tcx> {
fn visit_terminator(&mut self, terminator: &mir::Terminator<'_>, _loc: mir::Location) {
if let mir::TerminatorKind::Call {
args,
destination: Some((mir::Place { local: dest, .. }, _)),
destination: mir::Place { local: dest, .. },
..
} = &terminator.kind
{

View File

@ -301,6 +301,7 @@ fn check_terminator<'a, 'tcx>(
args,
from_hir_call: _,
destination: _,
target: _,
cleanup: _,
fn_span: _,
} => {