Skip to content

Commit 069b0c4

Browse files
committed
Cleanup
`for` loops are no longer closures.
1 parent 6bae4a7 commit 069b0c4

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

src/librustc/middle/liveness.rs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -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 `continue` 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(||

0 commit comments

Comments
 (0)