@@ -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.
@@ -191,7 +193,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
191
193
value,
192
194
)
193
195
) ;
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) )
195
199
}
196
200
ExprKind :: Cast { source } => {
197
201
let source_expr = & this. thir [ source] ;
@@ -359,6 +363,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
359
363
} )
360
364
. collect ( ) ;
361
365
366
+ this. record_operands_moved ( & fields. raw ) ;
362
367
block. and ( Rvalue :: Aggregate ( Box :: new ( AggregateKind :: Array ( el_ty) ) , fields) )
363
368
}
364
369
ExprKind :: Tuple { ref fields } => {
@@ -380,6 +385,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
380
385
} )
381
386
. collect ( ) ;
382
387
388
+ this. record_operands_moved ( & fields. raw ) ;
383
389
block. and ( Rvalue :: Aggregate ( Box :: new ( AggregateKind :: Tuple ) , fields) )
384
390
}
385
391
ExprKind :: Closure ( box ClosureExpr {
@@ -482,6 +488,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
482
488
Box :: new ( AggregateKind :: CoroutineClosure ( closure_id. to_def_id ( ) , args) )
483
489
}
484
490
} ;
491
+ this. record_operands_moved ( & operands. raw ) ;
485
492
block. and ( Rvalue :: Aggregate ( result, operands) )
486
493
}
487
494
ExprKind :: Assign { .. } | ExprKind :: AssignOp { .. } => {
0 commit comments