about summary refs log tree commit diff
diff options
context:
space:
mode:
authorShotaro Yamada <sinkuu@sinkuu.xyz>2019-01-03 23:20:44 +0900
committerShotaro Yamada <sinkuu@sinkuu.xyz>2019-01-03 23:25:41 +0900
commit069b0c410808c1d1d33b495e048b1186e9f8d57f (patch)
tree94b6fae7696502689e011ee5fa6a2a32ec2ab4c1
parent6bae4a763df95c436ce9f1286b1d593e67218932 (diff)
downloadrust-069b0c410808c1d1d33b495e048b1186e9f8d57f.tar.gz
rust-069b0c410808c1d1d33b495e048b1186e9f8d57f.zip
Cleanup
`for` loops are no longer closures.
-rw-r--r--src/librustc/middle/liveness.rs20
1 files changed, 1 insertions, 19 deletions
diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs
index 71a104ba6e7..2ca823929fd 100644
--- a/src/librustc/middle/liveness.rs
+++ b/src/librustc/middle/liveness.rs
@@ -911,17 +911,8 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
     }
 
     fn compute(&mut self, body: &hir::Expr) -> LiveNode {
-        // if there is a `break` or `continue` at the top level, then it's
-        // effectively a return---this only occurs in `for` loops,
-        // where the body is really a closure.
-
         debug!("compute: using id for body, {}", self.ir.tcx.hir().node_to_pretty_string(body.id));
 
-        let exit_ln = self.s.exit_ln;
-
-        self.break_ln.insert(body.id, exit_ln);
-        self.cont_ln.insert(body.id, exit_ln);
-
         // the fallthrough exit is only for those cases where we do not
         // explicitly return:
         let s = self.s;
@@ -1024,19 +1015,10 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
                 self.propagate_through_expr(&e, succ)
             }
 
-            hir::ExprKind::Closure(.., blk_id, _, _) => {
+            hir::ExprKind::Closure(..) => {
                 debug!("{} is an ExprKind::Closure",
                        self.ir.tcx.hir().node_to_pretty_string(expr.id));
 
-                // The next-node for a break is the successor of the entire
-                // loop. The next-node for a continue is the top of this loop.
-                let node = self.live_node(expr.hir_id, expr.span);
-
-                let break_ln = succ;
-                let cont_ln = node;
-                self.break_ln.insert(blk_id.node_id, break_ln);
-                self.cont_ln.insert(blk_id.node_id, cont_ln);
-
                 // the construction of a closure itself is not important,
                 // but we have to consider the closed over variables.
                 let caps = self.ir.capture_info_map.get(&expr.id).cloned().unwrap_or_else(||