@@ -467,12 +467,13 @@ fn locals_live_across_suspend_points(
467
467
dataflow:: ResultsCursor :: new ( body_ref, & requires_storage_results) ;
468
468
469
469
// Calculate the liveness of MIR locals ignoring borrows.
470
- let mut live_locals = liveness:: LiveVarSet :: new_empty ( body. local_decls . len ( ) ) ;
471
470
let mut liveness = liveness:: liveness_of_locals ( body) ;
472
471
liveness:: dump_mir ( tcx, "generator_liveness" , source, body_ref, & liveness) ;
473
472
474
473
let mut storage_liveness_map = IndexVec :: from_elem ( None , body. basic_blocks ( ) ) ;
475
474
let mut live_locals_at_suspension_points = Vec :: new ( ) ;
475
+ let mut live_locals_at_any_suspension_point =
476
+ liveness:: LiveVarSet :: new_empty ( body. local_decls . len ( ) ) ;
476
477
477
478
for ( block, data) in body. basic_blocks ( ) . iter_enumerated ( ) {
478
479
if let TerminatorKind :: Yield { .. } = data. terminator ( ) . kind {
@@ -509,39 +510,39 @@ fn locals_live_across_suspend_points(
509
510
// Locals live are live at this point only if they are used across
510
511
// suspension points (the `liveness` variable)
511
512
// and their storage is required (the `storage_required` variable)
512
- let mut live_locals_here = storage_required;
513
- live_locals_here . intersect ( & liveness. outs [ block] ) ;
513
+ let mut live_locals = storage_required;
514
+ live_locals . intersect ( & liveness. outs [ block] ) ;
514
515
515
516
// The generator argument is ignored.
516
- live_locals_here . remove ( SELF_ARG ) ;
517
+ live_locals . remove ( SELF_ARG ) ;
517
518
518
- debug ! ( "loc = {:?}, live_locals_here = {:?}" , loc, live_locals_here ) ;
519
+ debug ! ( "loc = {:?}, live_locals = {:?}" , loc, live_locals ) ;
519
520
520
521
// Add the locals live at this suspension point to the set of locals which live across
521
522
// any suspension points
522
- live_locals . union ( & live_locals_here ) ;
523
+ live_locals_at_any_suspension_point . union ( & live_locals ) ;
523
524
524
- live_locals_at_suspension_points. push ( live_locals_here ) ;
525
+ live_locals_at_suspension_points. push ( live_locals ) ;
525
526
}
526
527
}
527
- debug ! ( "live_locals = {:?}" , live_locals ) ;
528
+ debug ! ( "live_locals_anywhere = {:?}" , live_locals_at_any_suspension_point ) ;
528
529
529
530
// Renumber our liveness_map bitsets to include only the locals we are
530
531
// saving.
531
532
let live_locals_at_suspension_points = live_locals_at_suspension_points
532
533
. iter ( )
533
- . map ( |live_here| renumber_bitset ( & live_here, & live_locals ) )
534
+ . map ( |live_here| renumber_bitset ( & live_here, & live_locals_at_any_suspension_point ) )
534
535
. collect ( ) ;
535
536
536
537
let storage_conflicts = compute_storage_conflicts (
537
538
body_ref,
538
- & live_locals ,
539
+ & live_locals_at_any_suspension_point ,
539
540
always_live_locals. clone ( ) ,
540
541
requires_storage_results,
541
542
) ;
542
543
543
544
LivenessInfo {
544
- live_locals,
545
+ live_locals : live_locals_at_any_suspension_point ,
545
546
live_locals_at_suspension_points,
546
547
storage_conflicts,
547
548
storage_liveness : storage_liveness_map,
0 commit comments