librustc: remove unused DefUpvar field.
This commit is contained in:
parent
11ef6f1349
commit
ab9c773cdb
@ -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)),
|
||||
|
@ -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) => {
|
||||
|
@ -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, _, _) => {
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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)))
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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)[])
|
||||
|
Loading…
Reference in New Issue
Block a user