Use record_operands_moved more aggresively
This commit is contained in:
@@ -11,6 +11,8 @@ use rustc_middle::mir::*;
|
||||
use rustc_middle::ty::{self, Ty, UpvarSubsts};
|
||||
use rustc_span::Span;
|
||||
|
||||
use std::slice;
|
||||
|
||||
impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
/// Returns an rvalue suitable for use until the end of the current
|
||||
/// scope expression.
|
||||
@@ -117,7 +119,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
block =
|
||||
this.into(this.hir.tcx().mk_place_deref(Place::from(result)), block, value)
|
||||
);
|
||||
block.and(Rvalue::Use(Operand::Move(Place::from(result))))
|
||||
let result_operand = Operand::Move(Place::from(result));
|
||||
this.record_operands_moved(slice::from_ref(&result_operand));
|
||||
block.and(Rvalue::Use(result_operand))
|
||||
}
|
||||
ExprKind::Cast { source } => {
|
||||
let source = unpack!(block = this.as_operand(block, scope, source));
|
||||
@@ -161,6 +165,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
.map(|f| unpack!(block = this.as_operand(block, scope, f)))
|
||||
.collect();
|
||||
|
||||
this.record_operands_moved(&fields);
|
||||
block.and(Rvalue::Aggregate(box AggregateKind::Array(el_ty), fields))
|
||||
}
|
||||
ExprKind::Tuple { fields } => {
|
||||
@@ -171,6 +176,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
.map(|f| unpack!(block = this.as_operand(block, scope, f)))
|
||||
.collect();
|
||||
|
||||
this.record_operands_moved(&fields);
|
||||
block.and(Rvalue::Aggregate(box AggregateKind::Tuple, fields))
|
||||
}
|
||||
ExprKind::Closure { closure_id, substs, upvars, movability } => {
|
||||
@@ -222,6 +228,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
}
|
||||
UpvarSubsts::Closure(substs) => box AggregateKind::Closure(closure_id, substs),
|
||||
};
|
||||
this.record_operands_moved(&operands);
|
||||
block.and(Rvalue::Aggregate(result, operands))
|
||||
}
|
||||
ExprKind::Assign { .. } | ExprKind::AssignOp { .. } => {
|
||||
|
||||
Reference in New Issue
Block a user