Skip to content

Commit dca0776

Browse files
committed
Incorporate review comments (mostly fixing indentation)
Previous commit was r=nmatsakis
1 parent dd66e75 commit dca0776

File tree

3 files changed

+26
-28
lines changed

3 files changed

+26
-28
lines changed

src/rustc/middle/liveness.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -502,9 +502,9 @@ fn visit_expr(expr: @expr, &&self: @IrMaps, vt: vt<@IrMaps>) {
502502
}
503503
expr_fn(_, _, _, cap_clause) |
504504
expr_fn_block(_, _, cap_clause) => {
505-
// Interesting control flow (for loops can contain labeled
506-
// breaks or continues)
507-
self.add_live_node_for_node(expr.id, ExprNode(expr.span));
505+
// Interesting control flow (for loops can contain labeled
506+
// breaks or continues)
507+
self.add_live_node_for_node(expr.id, ExprNode(expr.span));
508508

509509
// Make a live_node for each captured variable, with the span
510510
// being the location that the variable is used. This results
@@ -596,7 +596,7 @@ struct Liveness {
596596
users: ~[mut users],
597597
// The list of node IDs for the nested loop scopes
598598
// we're in.
599-
mut loop_scope: @DVec<node_id>,
599+
loop_scope: DVec<node_id>,
600600
// mappings from loop node ID to LiveNode
601601
// ("break" label should map to loop node ID,
602602
// it probably doesn't now)
@@ -778,10 +778,10 @@ impl Liveness {
778778
Some(_) => // Refers to a labeled loop. Use the results of resolve
779779
// to find with one
780780
match self.tcx.def_map.find(id) {
781-
Some(def_label(loop_id)) => loop_id,
782-
_ => self.tcx.sess.span_bug(sp, ~"Label on break/loop \
783-
doesn't refer to a loop")
784-
},
781+
Some(def_label(loop_id)) => loop_id,
782+
_ => self.tcx.sess.span_bug(sp, ~"Label on break/loop \
783+
doesn't refer to a loop")
784+
},
785785
None =>
786786
// Vanilla 'break' or 'loop', so use the enclosing
787787
// loop scope
@@ -1024,7 +1024,7 @@ impl Liveness {
10241024
}
10251025

10261026
fn propagate_through_expr(expr: @expr, succ: LiveNode) -> LiveNode {
1027-
debug!("propagate_through_expr: %s",
1027+
debug!("propagate_through_expr: %s",
10281028
expr_to_str(expr, self.tcx.sess.intr()));
10291029

10301030
match expr.node {
@@ -1039,7 +1039,7 @@ impl Liveness {
10391039
}
10401040

10411041
expr_fn(_, _, blk, _) | expr_fn_block(_, blk, _) => {
1042-
debug!("%s is an expr_fn or expr_fn_block",
1042+
debug!("%s is an expr_fn or expr_fn_block",
10431043
expr_to_str(expr, self.tcx.sess.intr()));
10441044

10451045
/*

src/rustc/middle/trans/controlflow.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ fn trans_while(bcx: block, cond: @ast::expr, body: ast::blk)
113113
// | body_bcx_out --+
114114
// next_bcx
115115

116-
// tjc: while should have labels...
117116
let loop_bcx = loop_scope_block(bcx, next_bcx, None, ~"`while`",
118117
body.info());
119118
let cond_bcx_in = scope_block(loop_bcx, cond.info(), ~"while loop cond");
@@ -214,11 +213,11 @@ fn trans_break_cont(bcx: block, opt_label: Option<ident>, to_end: bool)
214213
match unwind.kind {
215214
block_scope({loop_break: Some(brk), loop_label: l, _}) => {
216215
// If we're looking for a labeled loop, check the label...
217-
target = if to_end {
218-
brk
219-
} else {
220-
unwind
221-
};
216+
target = if to_end {
217+
brk
218+
} else {
219+
unwind
220+
};
222221
match opt_label {
223222
Some(desired) => match l {
224223
Some(actual) if actual == desired => break,

src/rustc/middle/typeck/check.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2550,22 +2550,21 @@ fn may_break(cx: ty::ctxt, id: ast::node_id, b: ast::blk) -> bool {
25502550
// inside the loop?
25512551
(loop_query(b, |e| {
25522552
match e {
2553-
ast::expr_break(_) => true,
2554-
_ => false
2553+
ast::expr_break(_) => true,
2554+
_ => false
25552555
}
25562556
})) ||
25572557
// Second: is there a labeled break with label
25582558
// <id> nested anywhere inside the loop?
2559-
(block_query(b, |e| {
2560-
match e.node {
2561-
ast::expr_break(Some(_)) =>
2562-
match cx.def_map.find(e.id) {
2563-
Some(ast::def_label(loop_id)) if id == loop_id => true,
2564-
_ => false,
2565-
},
2566-
_ => false
2567-
}
2568-
}))
2559+
(block_query(b, |e| {
2560+
match e.node {
2561+
ast::expr_break(Some(_)) =>
2562+
match cx.def_map.find(e.id) {
2563+
Some(ast::def_label(loop_id)) if id == loop_id => true,
2564+
_ => false,
2565+
},
2566+
_ => false
2567+
}}))
25692568
}
25702569
25712570
fn check_bounds_are_used(ccx: @crate_ctxt,

0 commit comments

Comments
 (0)