@@ -20,6 +20,8 @@ use rustc_middle::ty::{self, Ty, UpvarArgs};
2020use rustc_span:: { Span , DUMMY_SP } ;
2121use tracing:: debug;
2222
23+ use std:: slice;
24+
2325impl < ' a , ' tcx > Builder < ' a , ' tcx > {
2426 /// Returns an rvalue suitable for use until the end of the current
2527 /// scope expression.
@@ -192,7 +194,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
192194 value,
193195 )
194196 ) ;
195- block. and ( Rvalue :: Use ( Operand :: Move ( Place :: from ( result) ) ) )
197+ let result_operand = Operand :: Move ( Place :: from ( result) ) ;
198+ this. record_operands_moved ( slice:: from_ref ( & result_operand) ) ;
199+ block. and ( Rvalue :: Use ( result_operand) )
196200 }
197201 ExprKind :: Cast { source } => {
198202 let source_expr = & this. thir [ source] ;
@@ -360,6 +364,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
360364 } )
361365 . collect ( ) ;
362366
367+ this. record_operands_moved ( & fields. raw ) ;
363368 block. and ( Rvalue :: Aggregate ( Box :: new ( AggregateKind :: Array ( el_ty) ) , fields) )
364369 }
365370 ExprKind :: Tuple { ref fields } => {
@@ -381,6 +386,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
381386 } )
382387 . collect ( ) ;
383388
389+ this. record_operands_moved ( & fields. raw ) ;
384390 block. and ( Rvalue :: Aggregate ( Box :: new ( AggregateKind :: Tuple ) , fields) )
385391 }
386392 ExprKind :: Closure ( box ClosureExpr {
@@ -483,6 +489,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
483489 Box :: new ( AggregateKind :: CoroutineClosure ( closure_id. to_def_id ( ) , args) )
484490 }
485491 } ;
492+ this. record_operands_moved ( & operands. raw ) ;
486493 block. and ( Rvalue :: Aggregate ( result, operands) )
487494 }
488495 ExprKind :: Assign { .. } | ExprKind :: AssignOp { .. } => {
0 commit comments