about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2012-10-22 09:44:56 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2012-10-22 09:44:56 -0700
commitdca0776747d62767b806aa32926301be949ffde7 (patch)
tree3cb0ba8ca9ddabefcfec59c56257efa33b1efd99
parentdd66e7549b72575d5d7e06c0173e702e28cdfba7 (diff)
downloadrust-dca0776747d62767b806aa32926301be949ffde7.tar.gz
rust-dca0776747d62767b806aa32926301be949ffde7.zip
Incorporate review comments (mostly fixing indentation)
Previous commit was r=nmatsakis
-rw-r--r--src/rustc/middle/liveness.rs20
-rw-r--r--src/rustc/middle/trans/controlflow.rs11
-rw-r--r--src/rustc/middle/typeck/check.rs23
3 files changed, 26 insertions, 28 deletions
diff --git a/src/rustc/middle/liveness.rs b/src/rustc/middle/liveness.rs
index 184d694a50c..2ed72a68f1b 100644
--- a/src/rustc/middle/liveness.rs
+++ b/src/rustc/middle/liveness.rs
@@ -502,9 +502,9 @@ fn visit_expr(expr: @expr, &&self: @IrMaps, vt: vt<@IrMaps>) {
       }
       expr_fn(_, _, _, cap_clause) |
       expr_fn_block(_, _, cap_clause) => {
-          // Interesting control flow (for loops can contain labeled
-          // breaks or continues)
-          self.add_live_node_for_node(expr.id, ExprNode(expr.span));
+        // Interesting control flow (for loops can contain labeled
+        // breaks or continues)
+        self.add_live_node_for_node(expr.id, ExprNode(expr.span));
 
         // Make a live_node for each captured variable, with the span
         // being the location that the variable is used.  This results
@@ -596,7 +596,7 @@ struct Liveness {
     users: ~[mut users],
     // The list of node IDs for the nested loop scopes
     // we're in.
-    mut loop_scope: @DVec<node_id>,
+    loop_scope: DVec<node_id>,
     // mappings from loop node ID to LiveNode
     // ("break" label should map to loop node ID,
     // it probably doesn't now)
@@ -778,10 +778,10 @@ impl Liveness {
             Some(_) => // Refers to a labeled loop. Use the results of resolve
                       // to find with one
                 match self.tcx.def_map.find(id) {
-                  Some(def_label(loop_id)) => loop_id,
-                  _ => self.tcx.sess.span_bug(sp, ~"Label on break/loop \
-                                                 doesn't refer to a loop")
-            },
+                    Some(def_label(loop_id)) => loop_id,
+                    _ => self.tcx.sess.span_bug(sp, ~"Label on break/loop \
+                                                    doesn't refer to a loop")
+                },
             None =>
                 // Vanilla 'break' or 'loop', so use the enclosing
                 // loop scope
@@ -1024,7 +1024,7 @@ impl Liveness {
     }
 
     fn propagate_through_expr(expr: @expr, succ: LiveNode) -> LiveNode {
-      debug!("propagate_through_expr: %s",
+        debug!("propagate_through_expr: %s",
              expr_to_str(expr, self.tcx.sess.intr()));
 
         match expr.node {
@@ -1039,7 +1039,7 @@ impl Liveness {
           }
 
           expr_fn(_, _, blk, _) | expr_fn_block(_, blk, _) => {
-            debug!("%s is an expr_fn or expr_fn_block",
+              debug!("%s is an expr_fn or expr_fn_block",
                    expr_to_str(expr, self.tcx.sess.intr()));
 
               /*
diff --git a/src/rustc/middle/trans/controlflow.rs b/src/rustc/middle/trans/controlflow.rs
index b1ca93f8f8a..59a733433bf 100644
--- a/src/rustc/middle/trans/controlflow.rs
+++ b/src/rustc/middle/trans/controlflow.rs
@@ -113,7 +113,6 @@ fn trans_while(bcx: block, cond: @ast::expr, body: ast::blk)
     //    |           body_bcx_out --+
     // next_bcx
 
-    // tjc: while should have labels...
     let loop_bcx = loop_scope_block(bcx, next_bcx, None, ~"`while`",
                                     body.info());
     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)
         match unwind.kind {
           block_scope({loop_break: Some(brk), loop_label: l, _}) => {
               // If we're looking for a labeled loop, check the label...
-            target = if to_end {
-                brk
-            } else {
-                unwind
-            };
+              target = if to_end {
+                  brk
+              } else {
+                  unwind
+              };
               match opt_label {
                   Some(desired) => match l {
                       Some(actual) if actual == desired => break,
diff --git a/src/rustc/middle/typeck/check.rs b/src/rustc/middle/typeck/check.rs
index e37c90d98b4..cc542e9f366 100644
--- a/src/rustc/middle/typeck/check.rs
+++ b/src/rustc/middle/typeck/check.rs
@@ -2550,22 +2550,21 @@ fn may_break(cx: ty::ctxt, id: ast::node_id, b: ast::blk) -> bool {
     // inside the loop?
     (loop_query(b, |e| {
         match e {
-          ast::expr_break(_) => true,
-          _ => false
+            ast::expr_break(_) => true,
+            _ => false
         }
     })) ||
    // Second: is there a labeled break with label
    // <id> nested anywhere inside the loop?
-   (block_query(b, |e| {
-       match e.node {
-           ast::expr_break(Some(_)) =>
-               match cx.def_map.find(e.id) {
-                 Some(ast::def_label(loop_id)) if id == loop_id => true,
-                 _ => false,
-              },
-           _ => false
-       }
-   }))
+    (block_query(b, |e| {
+        match e.node {
+            ast::expr_break(Some(_)) =>
+                match cx.def_map.find(e.id) {
+                    Some(ast::def_label(loop_id)) if id == loop_id => true,
+                    _ => false,
+                },
+            _ => false
+        }}))
 }
 
 fn check_bounds_are_used(ccx: @crate_ctxt,