@@ -467,12 +467,13 @@ fn locals_live_across_suspend_points(
467467 dataflow:: ResultsCursor :: new ( body_ref, & requires_storage_results) ;
468468
469469 // Calculate the liveness of MIR locals ignoring borrows.
470- let mut live_locals = liveness:: LiveVarSet :: new_empty ( body. local_decls . len ( ) ) ;
471470 let mut liveness = liveness:: liveness_of_locals ( body) ;
472471 liveness:: dump_mir ( tcx, "generator_liveness" , source, body_ref, & liveness) ;
473472
474473 let mut storage_liveness_map = IndexVec :: from_elem ( None , body. basic_blocks ( ) ) ;
475474 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 ( ) ) ;
476477
477478 for ( block, data) in body. basic_blocks ( ) . iter_enumerated ( ) {
478479 if let TerminatorKind :: Yield { .. } = data. terminator ( ) . kind {
@@ -509,39 +510,39 @@ fn locals_live_across_suspend_points(
509510 // Locals live are live at this point only if they are used across
510511 // suspension points (the `liveness` variable)
511512 // 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] ) ;
514515
515516 // The generator argument is ignored.
516- live_locals_here . remove ( SELF_ARG ) ;
517+ live_locals . remove ( SELF_ARG ) ;
517518
518- debug ! ( "loc = {:?}, live_locals_here = {:?}" , loc, live_locals_here ) ;
519+ debug ! ( "loc = {:?}, live_locals = {:?}" , loc, live_locals ) ;
519520
520521 // Add the locals live at this suspension point to the set of locals which live across
521522 // any suspension points
522- live_locals . union ( & live_locals_here ) ;
523+ live_locals_at_any_suspension_point . union ( & live_locals ) ;
523524
524- live_locals_at_suspension_points. push ( live_locals_here ) ;
525+ live_locals_at_suspension_points. push ( live_locals ) ;
525526 }
526527 }
527- debug ! ( "live_locals = {:?}" , live_locals ) ;
528+ debug ! ( "live_locals_anywhere = {:?}" , live_locals_at_any_suspension_point ) ;
528529
529530 // Renumber our liveness_map bitsets to include only the locals we are
530531 // saving.
531532 let live_locals_at_suspension_points = live_locals_at_suspension_points
532533 . 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 ) )
534535 . collect ( ) ;
535536
536537 let storage_conflicts = compute_storage_conflicts (
537538 body_ref,
538- & live_locals ,
539+ & live_locals_at_any_suspension_point ,
539540 always_live_locals. clone ( ) ,
540541 requires_storage_results,
541542 ) ;
542543
543544 LivenessInfo {
544- live_locals,
545+ live_locals : live_locals_at_any_suspension_point ,
545546 live_locals_at_suspension_points,
546547 storage_conflicts,
547548 storage_liveness : storage_liveness_map,
0 commit comments