about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorTaylor Cramer <cramertaylorj@gmail.com>2017-02-17 18:55:28 -0800
committerTaylor Cramer <cramertaylorj@gmail.com>2017-02-18 12:43:29 -0800
commita611bbcceb15ca6d191dbbb2436da92677d0ca99 (patch)
treeaf2d3d6741de53e90a43ab7f83545e18965b1b9a /src
parent56e519dd5c8df832dfb78a180ac771de3649b12f (diff)
downloadrust-a611bbcceb15ca6d191dbbb2436da92677d0ca99.tar.gz
rust-a611bbcceb15ca6d191dbbb2436da92677d0ca99.zip
Rename hir::Label to hir::Destination
Diffstat (limited to 'src')
-rw-r--r--src/librustc/cfg/construct.rs12
-rw-r--r--src/librustc/hir/lowering.rs20
-rw-r--r--src/librustc/hir/mod.rs6
3 files changed, 20 insertions, 18 deletions
diff --git a/src/librustc/cfg/construct.rs b/src/librustc/cfg/construct.rs
index fdb350ebaac..122543aee40 100644
--- a/src/librustc/cfg/construct.rs
+++ b/src/librustc/cfg/construct.rs
@@ -303,17 +303,17 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
                 self.add_unreachable_node()
             }
 
-            hir::ExprBreak(label, ref opt_expr) => {
+            hir::ExprBreak(destination, ref opt_expr) => {
                 let v = self.opt_expr(opt_expr, pred);
-                let loop_scope = self.find_scope(expr, label);
+                let loop_scope = self.find_scope(expr, destination);
                 let b = self.add_ast_node(expr.id, &[v]);
                 self.add_exiting_edge(expr, b,
                                       loop_scope, loop_scope.break_index);
                 self.add_unreachable_node()
             }
 
-            hir::ExprAgain(label) => {
-                let loop_scope = self.find_scope(expr, label);
+            hir::ExprAgain(destination) => {
+                let loop_scope = self.find_scope(expr, destination);
                 let a = self.add_ast_node(expr.id, &[pred]);
                 self.add_exiting_edge(expr, a,
                                       loop_scope, loop_scope.continue_index);
@@ -588,9 +588,9 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
 
     fn find_scope(&self,
                   expr: &hir::Expr,
-                  label: hir::Label) -> LoopScope {
+                  destination: hir::Destination) -> LoopScope {
 
-        match label.loop_id.into() {
+        match destination.loop_id.into() {
             Ok(loop_id) => {
                 for l in &self.loop_scopes {
                     if l.loop_id == loop_id {
diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs
index 55226fa7605..efb351e0325 100644
--- a/src/librustc/hir/lowering.rs
+++ b/src/librustc/hir/lowering.rs
@@ -326,9 +326,11 @@ impl<'a> LoweringContext<'a> {
         o_id.map(|sp_ident| respan(sp_ident.span, sp_ident.node.name))
     }
 
-    fn lower_label(&mut self, label: Option<(NodeId, Spanned<Ident>)>) -> hir::Label {
-        match label {
-            Some((id, label_ident)) => hir::Label {
+    fn lower_destination(&mut self, destination: Option<(NodeId, Spanned<Ident>)>)
+        -> hir::Destination
+    {
+        match destination {
+            Some((id, label_ident)) => hir::Destination {
                 ident: Some(label_ident),
                 loop_id: if let Def::Label(loop_id) = self.expect_full_def(id) {
                     hir::LoopIdResult::Ok(loop_id)
@@ -336,7 +338,7 @@ impl<'a> LoweringContext<'a> {
                     hir::LoopIdResult::Err(hir::LoopIdError::UnresolvedLabel)
                 }
             },
-            None => hir::Label {
+            None => hir::Destination {
                 ident: None,
                 loop_id: self.loop_scopes.last().map(|innermost_loop_id| Ok(*innermost_loop_id))
                             .unwrap_or(Err(hir::LoopIdError::OutsideLoopScope)).into()
@@ -1729,12 +1731,12 @@ impl<'a> LoweringContext<'a> {
                 }
                 ExprKind::Break(opt_ident, ref opt_expr) => {
                     let label_result = if self.is_in_loop_condition && opt_ident.is_none() {
-                        hir::Label {
+                        hir::Destination {
                             ident: opt_ident,
                             loop_id: Err(hir::LoopIdError::UnlabeledCfInWhileCondition).into(),
                         }
                     } else {
-                        self.lower_label(opt_ident.map(|ident| (e.id, ident)))
+                        self.lower_destination(opt_ident.map(|ident| (e.id, ident)))
                     };
                     hir::ExprBreak(
                             label_result,
@@ -1743,13 +1745,13 @@ impl<'a> LoweringContext<'a> {
                 ExprKind::Continue(opt_ident) =>
                     hir::ExprAgain(
                         if self.is_in_loop_condition && opt_ident.is_none() {
-                            hir::Label {
+                            hir::Destination {
                                 ident: opt_ident,
                                 loop_id: Err(
                                     hir::LoopIdError::UnlabeledCfInWhileCondition).into(),
                             }
                         } else {
-                            self.lower_label(opt_ident.map( | ident| (e.id, ident)))
+                            self.lower_destination(opt_ident.map( |ident| (e.id, ident)))
                         }),
                 ExprKind::Ret(ref e) => hir::ExprRet(e.as_ref().map(|x| P(self.lower_expr(x)))),
                 ExprKind::InlineAsm(ref asm) => {
@@ -2244,7 +2246,7 @@ impl<'a> LoweringContext<'a> {
     }
 
     fn expr_break(&mut self, span: Span, attrs: ThinVec<Attribute>) -> P<hir::Expr> {
-        let expr_break = hir::ExprBreak(self.lower_label(None), None);
+        let expr_break = hir::ExprBreak(self.lower_destination(None), None);
         P(self.expr(span, expr_break, attrs))
     }
 
diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs
index 4e4187cbf89..e8c5f2447cd 100644
--- a/src/librustc/hir/mod.rs
+++ b/src/librustc/hir/mod.rs
@@ -959,9 +959,9 @@ pub enum Expr_ {
     /// A referencing operation (`&a` or `&mut a`)
     ExprAddrOf(Mutability, P<Expr>),
     /// A `break`, with an optional label to break
-    ExprBreak(Label, Option<P<Expr>>),
+    ExprBreak(Destination, Option<P<Expr>>),
     /// A `continue`, with an optional label
-    ExprAgain(Label),
+    ExprAgain(Destination),
     /// A `return`, with an optional value to be returned
     ExprRet(Option<P<Expr>>),
 
@@ -1073,7 +1073,7 @@ impl From<Result<NodeId, LoopIdError>> for LoopIdResult {
 }
 
 #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
-pub struct Label {
+pub struct Destination {
     // This is `Some(_)` iff there is an explicit user-specified `label
     pub ident: Option<Spanned<Ident>>,