about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEduard Burtescu <edy.burt@gmail.com>2015-01-24 22:04:41 +0200
committerEduard Burtescu <edy.burt@gmail.com>2015-01-26 04:15:09 +0200
commitab9c773cdb17404dd5982add2980a35921b844b8 (patch)
tree06c8733b1934af7613b118b6369c84aad90d08cc
parent11ef6f1349d0917c099d7c88d630b0e5f6ee4393 (diff)
downloadrust-ab9c773cdb17404dd5982add2980a35921b844b8.tar.gz
rust-ab9c773cdb17404dd5982add2980a35921b844b8.zip
librustc: remove unused DefUpvar field.
-rw-r--r--src/librustc/middle/astencode.rs6
-rw-r--r--src/librustc/middle/def.rs6
-rw-r--r--src/librustc/middle/mem_categorization.rs2
-rw-r--r--src/librustc_resolve/lib.rs12
-rw-r--r--src/librustc_trans/trans/_match.rs6
-rw-r--r--src/librustc_trans/trans/expr.rs2
-rw-r--r--src/librustc_typeck/check/mod.rs2
-rw-r--r--src/librustc_typeck/check/regionck.rs9
8 files changed, 15 insertions, 30 deletions
diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs
index 3409c8d92be..fcc2be985a5 100644
--- a/src/librustc/middle/astencode.rs
+++ b/src/librustc/middle/astencode.rs
@@ -448,10 +448,8 @@ impl tr for def::Def {
           def::DefPrimTy(p) => def::DefPrimTy(p),
           def::DefTyParam(s, index, def_id, n) => def::DefTyParam(s, index, def_id.tr(dcx), n),
           def::DefUse(did) => def::DefUse(did.tr(dcx)),
-          def::DefUpvar(nid1, nid2, nid3) => {
-            def::DefUpvar(dcx.tr_id(nid1),
-                           dcx.tr_id(nid2),
-                           dcx.tr_id(nid3))
+          def::DefUpvar(nid1, nid2) => {
+            def::DefUpvar(dcx.tr_id(nid1), dcx.tr_id(nid2))
           }
           def::DefStruct(did) => def::DefStruct(did.tr(dcx)),
           def::DefRegion(nid) => def::DefRegion(dcx.tr_id(nid)),
diff --git a/src/librustc/middle/def.rs b/src/librustc/middle/def.rs
index 2e4aa787e84..2043dde72f4 100644
--- a/src/librustc/middle/def.rs
+++ b/src/librustc/middle/def.rs
@@ -43,9 +43,7 @@ pub enum Def {
     DefTyParam(ParamSpace, u32, ast::DefId, ast::Name),
     DefUse(ast::DefId),
     DefUpvar(ast::NodeId,  // id of closed over local
-             ast::NodeId,  // expr node that creates the closure
-             ast::NodeId), // block node for the closest enclosing proc
-                           // or unboxed closure, DUMMY_NODE_ID otherwise
+             ast::NodeId), // expr node that creates the closure
 
     /// Note that if it's a tuple struct's definition, the node id of the ast::DefId
     /// may either refer to the item definition's id or the StructDef.ctor_id.
@@ -145,7 +143,7 @@ impl Def {
             }
             DefLocal(id) |
             DefSelfTy(id) |
-            DefUpvar(id, _, _) |
+            DefUpvar(id, _) |
             DefRegion(id) |
             DefTyParamBinder(id) |
             DefLabel(id) => {
diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs
index 49e34d98799..fa49196e6c5 100644
--- a/src/librustc/middle/mem_categorization.rs
+++ b/src/librustc/middle/mem_categorization.rs
@@ -593,7 +593,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
               }))
           }
 
-          def::DefUpvar(var_id, fn_node_id, _) => {
+          def::DefUpvar(var_id, fn_node_id) => {
               let ty = try!(self.node_ty(fn_node_id));
               match ty.sty {
                   ty::ty_closure(closure_id, _, _) => {
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index 94801545c2f..084675cfe06 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.rs
@@ -243,7 +243,7 @@ enum RibKind {
 
     // We passed through a closure scope at the given node ID.
     // Translate upvars as appropriate.
-    ClosureRibKind(NodeId /* func id */, NodeId /* body id if proc or unboxed */),
+    ClosureRibKind(NodeId /* func id */),
 
     // We passed through an impl or trait and are now in one of its
     // methods. Allow references to ty params that impl or trait
@@ -2605,18 +2605,14 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
             DlDef(d @ DefLocal(_)) => {
                 let node_id = d.def_id().node;
                 let mut def = d;
-                let mut last_proc_body_id = ast::DUMMY_NODE_ID;
                 for rib in ribs.iter() {
                     match rib.kind {
                         NormalRibKind => {
                             // Nothing to do. Continue.
                         }
-                        ClosureRibKind(function_id, maybe_proc_body) => {
+                        ClosureRibKind(function_id) => {
                             let prev_def = def;
-                            if maybe_proc_body != ast::DUMMY_NODE_ID {
-                                last_proc_body_id = maybe_proc_body;
-                            }
-                            def = DefUpvar(node_id, function_id, last_proc_body_id);
+                            def = DefUpvar(node_id, function_id);
 
                             let mut seen = self.freevars_seen.borrow_mut();
                             let seen = match seen.entry(function_id) {
@@ -4523,7 +4519,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
 
             ExprClosure(capture_clause, _, ref fn_decl, ref block) => {
                 self.capture_mode_map.insert(expr.id, capture_clause);
-                self.resolve_function(ClosureRibKind(expr.id, ast::DUMMY_NODE_ID),
+                self.resolve_function(ClosureRibKind(expr.id),
                                       Some(&**fn_decl), NoTypeParameters,
                                       &**block);
             }
diff --git a/src/librustc_trans/trans/_match.rs b/src/librustc_trans/trans/_match.rs
index dcb0b0ef4ea..77ae119a024 100644
--- a/src/librustc_trans/trans/_match.rs
+++ b/src/librustc_trans/trans/_match.rs
@@ -1228,19 +1228,19 @@ pub fn trans_match<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
 fn is_discr_reassigned(bcx: Block, discr: &ast::Expr, body: &ast::Expr) -> bool {
     let (vid, field) = match discr.node {
         ast::ExprPath(_) | ast::ExprQPath(_) => match bcx.def(discr.id) {
-            def::DefLocal(vid) | def::DefUpvar(vid, _, _) => (vid, None),
+            def::DefLocal(vid) | def::DefUpvar(vid, _) => (vid, None),
             _ => return false
         },
         ast::ExprField(ref base, field) => {
             let vid = match bcx.tcx().def_map.borrow().get(&base.id) {
-                Some(&def::DefLocal(vid)) | Some(&def::DefUpvar(vid, _, _)) => vid,
+                Some(&def::DefLocal(vid)) | Some(&def::DefUpvar(vid, _)) => vid,
                 _ => return false
             };
             (vid, Some(mc::NamedField(field.node.name)))
         },
         ast::ExprTupField(ref base, field) => {
             let vid = match bcx.tcx().def_map.borrow().get(&base.id) {
-                Some(&def::DefLocal(vid)) | Some(&def::DefUpvar(vid, _, _)) => vid,
+                Some(&def::DefLocal(vid)) | Some(&def::DefUpvar(vid, _)) => vid,
                 _ => return false
             };
             (vid, Some(mc::PositionalField(field.node)))
diff --git a/src/librustc_trans/trans/expr.rs b/src/librustc_trans/trans/expr.rs
index 52087da9e9f..595212ad053 100644
--- a/src/librustc_trans/trans/expr.rs
+++ b/src/librustc_trans/trans/expr.rs
@@ -1263,7 +1263,7 @@ pub fn trans_local_var<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     let _icx = push_ctxt("trans_local_var");
 
     match def {
-        def::DefUpvar(nid, _, _) => {
+        def::DefUpvar(nid, _) => {
             // Can't move upvars, so this is never a ZeroMemLastUse.
             let local_ty = node_id_type(bcx, nid);
             match bcx.fcx.llupvars.borrow().get(&nid) {
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index be1ad18ba9f..5b172598ebb 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -4622,7 +4622,7 @@ pub fn type_scheme_for_def<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                                      defn: def::Def)
                                      -> TypeScheme<'tcx> {
     match defn {
-      def::DefLocal(nid) | def::DefUpvar(nid, _, _) => {
+      def::DefLocal(nid) | def::DefUpvar(nid, _) => {
           let typ = fcx.local_ty(sp, nid);
           return no_params(typ);
       }
diff --git a/src/librustc_typeck/check/regionck.rs b/src/librustc_typeck/check/regionck.rs
index c625caba2fe..f2a3d660925 100644
--- a/src/librustc_typeck/check/regionck.rs
+++ b/src/librustc_typeck/check/regionck.rs
@@ -177,16 +177,9 @@ pub struct Rcx<'a, 'tcx: 'a> {
 fn region_of_def(fcx: &FnCtxt, def: def::Def) -> ty::Region {
     let tcx = fcx.tcx();
     match def {
-        def::DefLocal(node_id) => {
+        def::DefLocal(node_id) | def::DefUpvar(node_id, _) => {
             tcx.region_maps.var_region(node_id)
         }
-        def::DefUpvar(node_id, _, body_id) => {
-            if body_id == ast::DUMMY_NODE_ID {
-                tcx.region_maps.var_region(node_id)
-            } else {
-                ReScope(CodeExtent::from_node_id(body_id))
-            }
-        }
         _ => {
             tcx.sess.bug(&format!("unexpected def in region_of_def: {:?}",
                                  def)[])