@@ -911,17 +911,8 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
911911 }
912912
913913 fn compute ( & mut self , body : & hir:: Expr ) -> LiveNode {
914- // if there is a `break` or `again` at the top level, then it's
915- // effectively a return---this only occurs in `for` loops,
916- // where the body is really a closure.
917-
918914 debug ! ( "compute: using id for body, {}" , self . ir. tcx. hir( ) . node_to_pretty_string( body. id) ) ;
919915
920- let exit_ln = self . s . exit_ln ;
921-
922- self . break_ln . insert ( body. id , exit_ln) ;
923- self . cont_ln . insert ( body. id , exit_ln) ;
924-
925916 // the fallthrough exit is only for those cases where we do not
926917 // explicitly return:
927918 let s = self . s ;
@@ -1024,19 +1015,10 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
10241015 self . propagate_through_expr ( & e, succ)
10251016 }
10261017
1027- hir:: ExprKind :: Closure ( .., blk_id , _ , _ ) => {
1018+ hir:: ExprKind :: Closure ( ..) => {
10281019 debug ! ( "{} is an ExprKind::Closure" ,
10291020 self . ir. tcx. hir( ) . node_to_pretty_string( expr. id) ) ;
10301021
1031- // The next-node for a break is the successor of the entire
1032- // loop. The next-node for a continue is the top of this loop.
1033- let node = self . live_node ( expr. hir_id , expr. span ) ;
1034-
1035- let break_ln = succ;
1036- let cont_ln = node;
1037- self . break_ln . insert ( blk_id. node_id , break_ln) ;
1038- self . cont_ln . insert ( blk_id. node_id , cont_ln) ;
1039-
10401022 // the construction of a closure itself is not important,
10411023 // but we have to consider the closed over variables.
10421024 let caps = self . ir . capture_info_map . get ( & expr. id ) . cloned ( ) . unwrap_or_else ( ||
@@ -1407,15 +1389,16 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
14071389 debug ! ( "propagate_through_loop: using id for loop body {} {}" ,
14081390 expr. id, self . ir. tcx. hir( ) . node_to_pretty_string( body. id) ) ;
14091391
1410- let break_ln = succ;
1411- let cont_ln = ln;
1412- self . break_ln . insert ( expr. id , break_ln) ;
1413- self . cont_ln . insert ( expr. id , cont_ln) ;
1392+
1393+ self . break_ln . insert ( expr. id , succ) ;
14141394
14151395 let cond_ln = match kind {
14161396 LoopLoop => ln,
14171397 WhileLoop ( ref cond) => self . propagate_through_expr ( & cond, ln) ,
14181398 } ;
1399+
1400+ self . cont_ln . insert ( expr. id , cond_ln) ;
1401+
14191402 let body_ln = self . propagate_through_block ( body, cond_ln) ;
14201403
14211404 // repeat until fixed point is reached:
0 commit comments