@@ -20,6 +20,8 @@ use rustc_middle::ty::{self, Ty, UpvarArgs};
20
20
use rustc_span:: { Span , DUMMY_SP } ;
21
21
use tracing:: debug;
22
22
23
+ use std:: slice;
24
+
23
25
impl < ' a , ' tcx > Builder < ' a , ' tcx > {
24
26
/// Returns an rvalue suitable for use until the end of the current
25
27
/// scope expression.
@@ -192,7 +194,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
192
194
value,
193
195
)
194
196
) ;
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) )
196
200
}
197
201
ExprKind :: Cast { source } => {
198
202
let source_expr = & this. thir [ source] ;
@@ -360,6 +364,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
360
364
} )
361
365
. collect ( ) ;
362
366
367
+ this. record_operands_moved ( & fields. raw ) ;
363
368
block. and ( Rvalue :: Aggregate ( Box :: new ( AggregateKind :: Array ( el_ty) ) , fields) )
364
369
}
365
370
ExprKind :: Tuple { ref fields } => {
@@ -381,6 +386,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
381
386
} )
382
387
. collect ( ) ;
383
388
389
+ this. record_operands_moved ( & fields. raw ) ;
384
390
block. and ( Rvalue :: Aggregate ( Box :: new ( AggregateKind :: Tuple ) , fields) )
385
391
}
386
392
ExprKind :: Closure ( box ClosureExpr {
@@ -483,6 +489,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
483
489
Box :: new ( AggregateKind :: CoroutineClosure ( closure_id. to_def_id ( ) , args) )
484
490
}
485
491
} ;
492
+ this. record_operands_moved ( & operands. raw ) ;
486
493
block. and ( Rvalue :: Aggregate ( result, operands) )
487
494
}
488
495
ExprKind :: Assign { .. } | ExprKind :: AssignOp { .. } => {
0 commit comments