@@ -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.
@@ -191,7 +193,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
191193 value,
192194 )
193195 ) ;
194- block. and ( Rvalue :: Use ( Operand :: Move ( Place :: from ( result) ) ) )
196+ let result_operand = Operand :: Move ( Place :: from ( result) ) ;
197+ this. record_operands_moved ( slice:: from_ref ( & result_operand) ) ;
198+ block. and ( Rvalue :: Use ( result_operand) )
195199 }
196200 ExprKind :: Cast { source } => {
197201 let source_expr = & this. thir [ source] ;
@@ -359,6 +363,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
359363 } )
360364 . collect ( ) ;
361365
366+ this. record_operands_moved ( & fields. raw ) ;
362367 block. and ( Rvalue :: Aggregate ( Box :: new ( AggregateKind :: Array ( el_ty) ) , fields) )
363368 }
364369 ExprKind :: Tuple { ref fields } => {
@@ -380,6 +385,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
380385 } )
381386 . collect ( ) ;
382387
388+ this. record_operands_moved ( & fields. raw ) ;
383389 block. and ( Rvalue :: Aggregate ( Box :: new ( AggregateKind :: Tuple ) , fields) )
384390 }
385391 ExprKind :: Closure ( box ClosureExpr {
@@ -482,6 +488,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
482488 Box :: new ( AggregateKind :: CoroutineClosure ( closure_id. to_def_id ( ) , args) )
483489 }
484490 } ;
491+ this. record_operands_moved ( & operands. raw ) ;
485492 block. and ( Rvalue :: Aggregate ( result, operands) )
486493 }
487494 ExprKind :: Assign { .. } | ExprKind :: AssignOp { .. } => {
0 commit comments