Skip to content

Commit e139793

Browse files
committed
purge unused loop_cont field
1 parent efa2252 commit e139793

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

src/rustc/middle/trans/base.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,8 +1783,7 @@ fn trans_while(cx: block, cond: @ast::expr, body: ast::blk)
17831783
-> block {
17841784
let _icx = cx.insn_ctxt("trans_while");
17851785
let next_cx = sub_block(cx, "while next");
1786-
let loop_cx = loop_scope_block(cx, cont_self, next_cx,
1787-
"while loop", body.span);
1786+
let loop_cx = loop_scope_block(cx, next_cx, "`while`", body.span);
17881787
let cond_cx = scope_block(loop_cx, "while loop cond");
17891788
let body_cx = scope_block(loop_cx, "while loop body");
17901789
Br(cx, loop_cx.llbb);
@@ -1800,9 +1799,7 @@ fn trans_while(cx: block, cond: @ast::expr, body: ast::blk)
18001799
fn trans_loop(cx:block, body: ast::blk) -> block {
18011800
let _icx = cx.insn_ctxt("trans_loop");
18021801
let next_cx = sub_block(cx, "next");
1803-
let body_cx =
1804-
loop_scope_block(cx, cont_self, next_cx,
1805-
"infinite loop body", body.span);
1802+
let body_cx = loop_scope_block(cx, next_cx, "`loop`", body.span);
18061803
let body_end = trans_block(body_cx, body, ignore);
18071804
cleanup_and_Br(body_end, body_cx, body_cx.llbb);
18081805
Br(cx, body_cx.llbb);
@@ -3567,14 +3564,11 @@ fn trans_break_cont(bcx: block, to_end: bool)
35673564
let mut target = bcx;
35683565
loop {
35693566
alt unwind.kind {
3570-
block_scope({is_loop: some({cnt, brk}), _}) {
3567+
block_scope({loop_break: some(brk), _}) {
35713568
target = if to_end {
35723569
brk
35733570
} else {
3574-
alt cnt {
3575-
cont_other(o) { o }
3576-
cont_self { unwind }
3577-
}
3571+
unwind
35783572
};
35793573
break;
35803574
}
@@ -3755,7 +3749,7 @@ fn new_block(cx: fn_ctxt, parent: block_parent, kind: block_kind,
37553749
}
37563750

37573751
fn simple_block_scope() -> block_kind {
3758-
block_scope({is_loop: none, mut cleanups: [],
3752+
block_scope({loop_break: none, mut cleanups: [],
37593753
mut cleanup_paths: [], mut landing_pad: none})
37603754
}
37613755

@@ -3770,11 +3764,10 @@ fn scope_block(bcx: block, n: str) -> block {
37703764
n, none);
37713765
}
37723766

3773-
fn loop_scope_block(bcx: block, _cont: loop_cont,
3774-
_break: block, n: str, sp: span)
3767+
fn loop_scope_block(bcx: block, loop_break: block, n: str, sp: span)
37753768
-> block {
37763769
ret new_block(bcx.fcx, parent_some(bcx), block_scope({
3777-
is_loop: some({cnt: _cont, brk: _break}),
3770+
loop_break: some(loop_break),
37783771
mut cleanups: [],
37793772
mut cleanup_paths: [],
37803773
mut landing_pad: none

src/rustc/middle/trans/common.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,8 @@ enum block_kind {
300300
block_non_scope,
301301
}
302302

303-
enum loop_cont { cont_self, cont_other(block), }
304-
305303
type scope_info = {
306-
is_loop: option<{cnt: loop_cont, brk: block}>,
304+
loop_break: option<block>,
307305
// A list of functions that must be run at when leaving this
308306
// block, cleaning up any variables that were introduced in the
309307
// block.

0 commit comments

Comments
 (0)