Introduce semi-duplicate DefIds into DefLocal/DefUpvar to remove use
of xxx_local.
This commit is contained in:
@@ -461,7 +461,11 @@ impl tr for def::Def {
|
|||||||
def::DefStatic(did, m) => { def::DefStatic(did.tr(dcx), m) }
|
def::DefStatic(did, m) => { def::DefStatic(did.tr(dcx), m) }
|
||||||
def::DefConst(did) => { def::DefConst(did.tr(dcx)) }
|
def::DefConst(did) => { def::DefConst(did.tr(dcx)) }
|
||||||
def::DefAssociatedConst(did) => def::DefAssociatedConst(did.tr(dcx)),
|
def::DefAssociatedConst(did) => def::DefAssociatedConst(did.tr(dcx)),
|
||||||
def::DefLocal(nid) => { def::DefLocal(dcx.tr_id(nid)) }
|
def::DefLocal(_, nid) => {
|
||||||
|
let nid = dcx.tr_id(nid);
|
||||||
|
let did = dcx.tcx.map.local_def_id(nid);
|
||||||
|
def::DefLocal(did, nid)
|
||||||
|
}
|
||||||
def::DefVariant(e_did, v_did, is_s) => {
|
def::DefVariant(e_did, v_did, is_s) => {
|
||||||
def::DefVariant(e_did.tr(dcx), v_did.tr(dcx), is_s)
|
def::DefVariant(e_did.tr(dcx), v_did.tr(dcx), is_s)
|
||||||
},
|
},
|
||||||
@@ -472,8 +476,11 @@ impl tr for def::Def {
|
|||||||
def::DefPrimTy(p) => def::DefPrimTy(p),
|
def::DefPrimTy(p) => def::DefPrimTy(p),
|
||||||
def::DefTyParam(s, index, def_id, n) => def::DefTyParam(s, index, def_id.tr(dcx), n),
|
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::DefUse(did) => def::DefUse(did.tr(dcx)),
|
||||||
def::DefUpvar(nid1, index, nid2) => {
|
def::DefUpvar(_, nid1, index, nid2) => {
|
||||||
def::DefUpvar(dcx.tr_id(nid1), index, dcx.tr_id(nid2))
|
let nid1 = dcx.tr_id(nid1);
|
||||||
|
let nid2 = dcx.tr_id(nid2);
|
||||||
|
let did1 = dcx.tcx.map.local_def_id(nid1);
|
||||||
|
def::DefUpvar(did1, nid1, index, nid2)
|
||||||
}
|
}
|
||||||
def::DefStruct(did) => def::DefStruct(did.tr(dcx)),
|
def::DefStruct(did) => def::DefStruct(did.tr(dcx)),
|
||||||
def::DefLabel(nid) => def::DefLabel(dcx.tr_id(nid))
|
def::DefLabel(nid) => def::DefLabel(dcx.tr_id(nid))
|
||||||
|
|||||||
@@ -659,7 +659,7 @@ fn check_expr<'a, 'tcx>(v: &mut CheckCrateVisitor<'a, 'tcx>,
|
|||||||
doesn't point to a constant");
|
doesn't point to a constant");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(def::DefLocal(_)) if v.mode == Mode::ConstFn => {
|
Some(def::DefLocal(..)) if v.mode == Mode::ConstFn => {
|
||||||
// Sadly, we can't determine whether the types are zero-sized.
|
// Sadly, we can't determine whether the types are zero-sized.
|
||||||
v.add_qualif(ConstQualif::NOT_CONST | ConstQualif::NON_ZERO_SIZED);
|
v.add_qualif(ConstQualif::NOT_CONST | ConstQualif::NON_ZERO_SIZED);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ fn check_for_bindings_named_the_same_as_variants(cx: &MatchCheckCtxt, pat: &Pat)
|
|||||||
let pat_ty = cx.tcx.pat_ty(p);
|
let pat_ty = cx.tcx.pat_ty(p);
|
||||||
if let ty::TyEnum(edef, _) = pat_ty.sty {
|
if let ty::TyEnum(edef, _) = pat_ty.sty {
|
||||||
let def = cx.tcx.def_map.borrow().get(&p.id).map(|d| d.full_def());
|
let def = cx.tcx.def_map.borrow().get(&p.id).map(|d| d.full_def());
|
||||||
if let Some(DefLocal(_)) = def {
|
if let Some(DefLocal(..)) = def {
|
||||||
if edef.variants.iter().any(|variant|
|
if edef.variants.iter().any(|variant|
|
||||||
variant.name == ident.node.name
|
variant.name == ident.node.name
|
||||||
&& variant.kind() == VariantKind::Unit
|
&& variant.kind() == VariantKind::Unit
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ pub enum Def {
|
|||||||
DefStatic(DefId, bool /* is_mutbl */),
|
DefStatic(DefId, bool /* is_mutbl */),
|
||||||
DefConst(DefId),
|
DefConst(DefId),
|
||||||
DefAssociatedConst(DefId),
|
DefAssociatedConst(DefId),
|
||||||
DefLocal(ast::NodeId),
|
DefLocal(DefId, // def id of variable
|
||||||
|
ast::NodeId), // node id of variable
|
||||||
DefVariant(DefId /* enum */, DefId /* variant */, bool /* is_structure */),
|
DefVariant(DefId /* enum */, DefId /* variant */, bool /* is_structure */),
|
||||||
DefTy(DefId, bool /* is_enum */),
|
DefTy(DefId, bool /* is_enum */),
|
||||||
DefAssociatedTy(DefId /* trait */, DefId),
|
DefAssociatedTy(DefId /* trait */, DefId),
|
||||||
@@ -37,7 +38,8 @@ pub enum Def {
|
|||||||
DefPrimTy(hir::PrimTy),
|
DefPrimTy(hir::PrimTy),
|
||||||
DefTyParam(ParamSpace, u32, DefId, ast::Name),
|
DefTyParam(ParamSpace, u32, DefId, ast::Name),
|
||||||
DefUse(DefId),
|
DefUse(DefId),
|
||||||
DefUpvar(ast::NodeId, // id of closed over local
|
DefUpvar(DefId, // def id of closed over local
|
||||||
|
ast::NodeId, // node id of closed over local
|
||||||
usize, // index in the freevars list of the closure
|
usize, // index in the freevars list of the closure
|
||||||
ast::NodeId), // expr node that creates the closure
|
ast::NodeId), // expr node that creates the closure
|
||||||
|
|
||||||
@@ -115,8 +117,8 @@ pub struct Export {
|
|||||||
impl Def {
|
impl Def {
|
||||||
pub fn var_id(&self) -> ast::NodeId {
|
pub fn var_id(&self) -> ast::NodeId {
|
||||||
match *self {
|
match *self {
|
||||||
DefLocal(id) |
|
DefLocal(_, id) |
|
||||||
DefUpvar(id, _, _) => {
|
DefUpvar(_, id, _, _) => {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,15 +137,11 @@ impl Def {
|
|||||||
DefFn(id, _) | DefMod(id) | DefForeignMod(id) | DefStatic(id, _) |
|
DefFn(id, _) | DefMod(id) | DefForeignMod(id) | DefStatic(id, _) |
|
||||||
DefVariant(_, id, _) | DefTy(id, _) | DefAssociatedTy(_, id) |
|
DefVariant(_, id, _) | DefTy(id, _) | DefAssociatedTy(_, id) |
|
||||||
DefTyParam(_, _, id, _) | DefUse(id) | DefStruct(id) | DefTrait(id) |
|
DefTyParam(_, _, id, _) | DefUse(id) | DefStruct(id) | DefTrait(id) |
|
||||||
DefMethod(id) | DefConst(id) | DefAssociatedConst(id) => {
|
DefMethod(id) | DefConst(id) | DefAssociatedConst(id) |
|
||||||
|
DefLocal(id, _) | DefUpvar(id, _, _, _) => {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
|
|
||||||
DefLocal(id) |
|
|
||||||
DefUpvar(id, _, _) => {
|
|
||||||
DefId::xxx_local(id) // TODO, clearly
|
|
||||||
}
|
|
||||||
|
|
||||||
DefLabel(..) |
|
DefLabel(..) |
|
||||||
DefPrimTy(..) |
|
DefPrimTy(..) |
|
||||||
DefSelfTy(..) => {
|
DefSelfTy(..) => {
|
||||||
|
|||||||
@@ -280,11 +280,9 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
|
|||||||
typer: &'t infer::InferCtxt<'a, 'tcx>)
|
typer: &'t infer::InferCtxt<'a, 'tcx>)
|
||||||
-> ExprUseVisitor<'d,'t,'a,'tcx> where 'tcx:'a
|
-> ExprUseVisitor<'d,'t,'a,'tcx> where 'tcx:'a
|
||||||
{
|
{
|
||||||
ExprUseVisitor {
|
let mc: mc::MemCategorizationContext<'t, 'a, 'tcx> =
|
||||||
typer: typer,
|
mc::MemCategorizationContext::new(typer);
|
||||||
mc: mc::MemCategorizationContext::new(typer),
|
ExprUseVisitor { typer: typer, mc: mc, delegate: delegate }
|
||||||
delegate: delegate,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn walk_fn(&mut self,
|
pub fn walk_fn(&mut self,
|
||||||
|
|||||||
@@ -465,7 +465,7 @@ fn visit_expr(ir: &mut IrMaps, expr: &Expr) {
|
|||||||
let mut call_caps = Vec::new();
|
let mut call_caps = Vec::new();
|
||||||
ir.tcx.with_freevars(expr.id, |freevars| {
|
ir.tcx.with_freevars(expr.id, |freevars| {
|
||||||
for fv in freevars {
|
for fv in freevars {
|
||||||
if let DefLocal(rv) = fv.def {
|
if let DefLocal(_, rv) = fv.def {
|
||||||
let fv_ln = ir.add_live_node(FreeVarNode(fv.span));
|
let fv_ln = ir.add_live_node(FreeVarNode(fv.span));
|
||||||
call_caps.push(CaptureInfo {ln: fv_ln,
|
call_caps.push(CaptureInfo {ln: fv_ln,
|
||||||
var_nid: rv});
|
var_nid: rv});
|
||||||
@@ -1268,7 +1268,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
|
|||||||
fn access_path(&mut self, expr: &Expr, succ: LiveNode, acc: u32)
|
fn access_path(&mut self, expr: &Expr, succ: LiveNode, acc: u32)
|
||||||
-> LiveNode {
|
-> LiveNode {
|
||||||
match self.ir.tcx.def_map.borrow().get(&expr.id).unwrap().full_def() {
|
match self.ir.tcx.def_map.borrow().get(&expr.id).unwrap().full_def() {
|
||||||
DefLocal(nid) => {
|
DefLocal(_, nid) => {
|
||||||
let ln = self.live_node(expr.id, expr.span);
|
let ln = self.live_node(expr.id, expr.span);
|
||||||
if acc != 0 {
|
if acc != 0 {
|
||||||
self.init_from_succ(ln, succ);
|
self.init_from_succ(ln, succ);
|
||||||
@@ -1517,9 +1517,9 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
|
|||||||
fn check_lvalue(&mut self, expr: &Expr) {
|
fn check_lvalue(&mut self, expr: &Expr) {
|
||||||
match expr.node {
|
match expr.node {
|
||||||
hir::ExprPath(..) => {
|
hir::ExprPath(..) => {
|
||||||
if let DefLocal(nid) = self.ir.tcx.def_map.borrow().get(&expr.id)
|
if let DefLocal(_, nid) = self.ir.tcx.def_map.borrow().get(&expr.id)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.full_def() {
|
.full_def() {
|
||||||
// Assignment to an immutable variable or argument: only legal
|
// Assignment to an immutable variable or argument: only legal
|
||||||
// if there is no later assignment. If this local is actually
|
// if there is no later assignment. If this local is actually
|
||||||
// mutable, then check for a reassignment to flag the mutability
|
// mutable, then check for a reassignment to flag the mutability
|
||||||
|
|||||||
@@ -575,7 +575,7 @@ impl<'t, 'a,'tcx> MemCategorizationContext<'t, 'a, 'tcx> {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
def::DefUpvar(var_id, _, fn_node_id) => {
|
def::DefUpvar(_, var_id, _, fn_node_id) => {
|
||||||
let ty = try!(self.node_ty(fn_node_id));
|
let ty = try!(self.node_ty(fn_node_id));
|
||||||
match ty.sty {
|
match ty.sty {
|
||||||
ty::TyClosure(closure_id, _) => {
|
ty::TyClosure(closure_id, _) => {
|
||||||
@@ -600,7 +600,7 @@ impl<'t, 'a,'tcx> MemCategorizationContext<'t, 'a, 'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def::DefLocal(vid) => {
|
def::DefLocal(_, vid) => {
|
||||||
Ok(Rc::new(cmt_ {
|
Ok(Rc::new(cmt_ {
|
||||||
id: id,
|
id: id,
|
||||||
span: span,
|
span: span,
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ impl LateLintPass for NonSnakeCase {
|
|||||||
fn check_pat(&mut self, cx: &LateContext, p: &hir::Pat) {
|
fn check_pat(&mut self, cx: &LateContext, p: &hir::Pat) {
|
||||||
if let &hir::PatIdent(_, ref path1, _) = &p.node {
|
if let &hir::PatIdent(_, ref path1, _) = &p.node {
|
||||||
let def = cx.tcx.def_map.borrow().get(&p.id).map(|d| d.full_def());
|
let def = cx.tcx.def_map.borrow().get(&p.id).map(|d| d.full_def());
|
||||||
if let Some(def::DefLocal(_)) = def {
|
if let Some(def::DefLocal(..)) = def {
|
||||||
self.check_snake_case(cx, "variable", &path1.node.name.as_str(), Some(p.span));
|
self.check_snake_case(cx, "variable", &path1.node.name.as_str(), Some(p.span));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -248,7 +248,8 @@ impl LateLintPass for NonShorthandFieldPatterns {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let def = def_map.get(&fieldpat.node.pat.id).map(|d| d.full_def());
|
let def = def_map.get(&fieldpat.node.pat.id).map(|d| d.full_def());
|
||||||
def == Some(def::DefLocal(fieldpat.node.pat.id))
|
let def_id = cx.tcx.map.local_def_id(fieldpat.node.pat.id);
|
||||||
|
def == Some(def::DefLocal(def_id, fieldpat.node.pat.id))
|
||||||
});
|
});
|
||||||
for fieldpat in field_pats {
|
for fieldpat in field_pats {
|
||||||
if let hir::PatIdent(_, ident, None) = fieldpat.node.pat.node {
|
if let hir::PatIdent(_, ident, None) = fieldpat.node.pat.node {
|
||||||
|
|||||||
@@ -569,13 +569,13 @@ fn convert_var<'a,'tcx:'a>(cx: &mut Cx<'a,'tcx>,
|
|||||||
let temp_lifetime = cx.tcx.region_maps.temporary_scope(expr.id);
|
let temp_lifetime = cx.tcx.region_maps.temporary_scope(expr.id);
|
||||||
|
|
||||||
match def {
|
match def {
|
||||||
def::DefLocal(node_id) => {
|
def::DefLocal(_, node_id) => {
|
||||||
ExprKind::VarRef {
|
ExprKind::VarRef {
|
||||||
id: node_id,
|
id: node_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def::DefUpvar(id_var, index, closure_expr_id) => {
|
def::DefUpvar(_, id_var, index, closure_expr_id) => {
|
||||||
debug!("convert_var(upvar({:?}, {:?}, {:?}))", id_var, index, closure_expr_id);
|
debug!("convert_var(upvar({:?}, {:?}, {:?}))", id_var, index, closure_expr_id);
|
||||||
let var_ty = cx.tcx.node_id_to_type(id_var);
|
let var_ty = cx.tcx.node_id_to_type(id_var);
|
||||||
|
|
||||||
|
|||||||
@@ -1982,7 +1982,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||||||
self.session.span_bug(span,
|
self.session.span_bug(span,
|
||||||
&format!("unexpected {:?} in bindings", def))
|
&format!("unexpected {:?} in bindings", def))
|
||||||
}
|
}
|
||||||
DefLocal(node_id) => {
|
DefLocal(_, node_id) => {
|
||||||
for rib in ribs {
|
for rib in ribs {
|
||||||
match rib.kind {
|
match rib.kind {
|
||||||
NormalRibKind => {
|
NormalRibKind => {
|
||||||
@@ -1990,11 +1990,12 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||||||
}
|
}
|
||||||
ClosureRibKind(function_id) => {
|
ClosureRibKind(function_id) => {
|
||||||
let prev_def = def;
|
let prev_def = def;
|
||||||
|
let node_def_id = self.ast_map.local_def_id(node_id);
|
||||||
|
|
||||||
let mut seen = self.freevars_seen.borrow_mut();
|
let mut seen = self.freevars_seen.borrow_mut();
|
||||||
let seen = seen.entry(function_id).or_insert_with(|| NodeMap());
|
let seen = seen.entry(function_id).or_insert_with(|| NodeMap());
|
||||||
if let Some(&index) = seen.get(&node_id) {
|
if let Some(&index) = seen.get(&node_id) {
|
||||||
def = DefUpvar(node_id, index, function_id);
|
def = DefUpvar(node_def_id, node_id, index, function_id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let mut freevars = self.freevars.borrow_mut();
|
let mut freevars = self.freevars.borrow_mut();
|
||||||
@@ -2003,7 +2004,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||||||
let depth = vec.len();
|
let depth = vec.len();
|
||||||
vec.push(Freevar { def: prev_def, span: span });
|
vec.push(Freevar { def: prev_def, span: span });
|
||||||
|
|
||||||
def = DefUpvar(node_id, depth, function_id);
|
def = DefUpvar(node_def_id, node_id, depth, function_id);
|
||||||
seen.insert(node_id, depth);
|
seen.insert(node_id, depth);
|
||||||
}
|
}
|
||||||
ItemRibKind | MethodRibKind => {
|
ItemRibKind | MethodRibKind => {
|
||||||
@@ -2817,7 +2818,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||||||
debug!("(resolving pattern) binding `{}`",
|
debug!("(resolving pattern) binding `{}`",
|
||||||
renamed);
|
renamed);
|
||||||
|
|
||||||
let def = DefLocal(pattern.id);
|
let def_id = self.ast_map.local_def_id(pattern.id);
|
||||||
|
let def = DefLocal(def_id, pattern.id);
|
||||||
|
|
||||||
// Record the definition so that later passes
|
// Record the definition so that later passes
|
||||||
// will be able to distinguish variants from
|
// will be able to distinguish variants from
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
|
|||||||
def::DefStatic(_, _) |
|
def::DefStatic(_, _) |
|
||||||
def::DefConst(_) |
|
def::DefConst(_) |
|
||||||
def::DefAssociatedConst(..) |
|
def::DefAssociatedConst(..) |
|
||||||
def::DefLocal(_) |
|
def::DefLocal(..) |
|
||||||
def::DefVariant(_, _, _) |
|
def::DefVariant(_, _, _) |
|
||||||
def::DefUpvar(..) => Some(recorder::VarRef),
|
def::DefUpvar(..) => Some(recorder::VarRef),
|
||||||
|
|
||||||
@@ -721,7 +721,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
def::DefLocal(_) |
|
def::DefLocal(..) |
|
||||||
def::DefStatic(_,_) |
|
def::DefStatic(_,_) |
|
||||||
def::DefConst(..) |
|
def::DefConst(..) |
|
||||||
def::DefAssociatedConst(..) |
|
def::DefAssociatedConst(..) |
|
||||||
@@ -1170,7 +1170,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
|
|||||||
}
|
}
|
||||||
let def = def_map.get(&id).unwrap().full_def();
|
let def = def_map.get(&id).unwrap().full_def();
|
||||||
match def {
|
match def {
|
||||||
def::DefLocal(id) => {
|
def::DefLocal(_, id) => {
|
||||||
let value = if immut == ast::MutImmutable {
|
let value = if immut == ast::MutImmutable {
|
||||||
self.span.snippet(p.span).to_string()
|
self.span.snippet(p.span).to_string()
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1432,19 +1432,19 @@ pub fn trans_match<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
|||||||
fn is_discr_reassigned(bcx: Block, discr: &hir::Expr, body: &hir::Expr) -> bool {
|
fn is_discr_reassigned(bcx: Block, discr: &hir::Expr, body: &hir::Expr) -> bool {
|
||||||
let (vid, field) = match discr.node {
|
let (vid, field) = match discr.node {
|
||||||
hir::ExprPath(..) => match bcx.def(discr.id) {
|
hir::ExprPath(..) => match bcx.def(discr.id) {
|
||||||
def::DefLocal(vid) | def::DefUpvar(vid, _, _) => (vid, None),
|
def::DefLocal(_, vid) | def::DefUpvar(_, vid, _, _) => (vid, None),
|
||||||
_ => return false
|
_ => return false
|
||||||
},
|
},
|
||||||
hir::ExprField(ref base, field) => {
|
hir::ExprField(ref base, field) => {
|
||||||
let vid = match bcx.tcx().def_map.borrow().get(&base.id).map(|d| d.full_def()) {
|
let vid = match bcx.tcx().def_map.borrow().get(&base.id).map(|d| d.full_def()) {
|
||||||
Some(def::DefLocal(vid)) | Some(def::DefUpvar(vid, _, _)) => vid,
|
Some(def::DefLocal(_, vid)) | Some(def::DefUpvar(_, vid, _, _)) => vid,
|
||||||
_ => return false
|
_ => return false
|
||||||
};
|
};
|
||||||
(vid, Some(mc::NamedField(field.node)))
|
(vid, Some(mc::NamedField(field.node)))
|
||||||
},
|
},
|
||||||
hir::ExprTupField(ref base, field) => {
|
hir::ExprTupField(ref base, field) => {
|
||||||
let vid = match bcx.tcx().def_map.borrow().get(&base.id).map(|d| d.full_def()) {
|
let vid = match bcx.tcx().def_map.borrow().get(&base.id).map(|d| d.full_def()) {
|
||||||
Some(def::DefLocal(vid)) | Some(def::DefUpvar(vid, _, _)) => vid,
|
Some(def::DefLocal(_, vid)) | Some(def::DefUpvar(_, vid, _, _)) => vid,
|
||||||
_ => return false
|
_ => return false
|
||||||
};
|
};
|
||||||
(vid, Some(mc::PositionalField(field.node)))
|
(vid, Some(mc::PositionalField(field.node)))
|
||||||
|
|||||||
@@ -783,7 +783,7 @@ fn const_expr_unadjusted<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
|
|||||||
hir::ExprPath(..) => {
|
hir::ExprPath(..) => {
|
||||||
let def = cx.tcx().def_map.borrow().get(&e.id).unwrap().full_def();
|
let def = cx.tcx().def_map.borrow().get(&e.id).unwrap().full_def();
|
||||||
match def {
|
match def {
|
||||||
def::DefLocal(id) => {
|
def::DefLocal(_, id) => {
|
||||||
if let Some(val) = fn_args.and_then(|args| args.get(&id).cloned()) {
|
if let Some(val) = fn_args.and_then(|args| args.get(&id).cloned()) {
|
||||||
val
|
val
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1358,7 +1358,7 @@ pub fn trans_local_var<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
|||||||
let _icx = push_ctxt("trans_local_var");
|
let _icx = push_ctxt("trans_local_var");
|
||||||
|
|
||||||
match def {
|
match def {
|
||||||
def::DefUpvar(nid, _, _) => {
|
def::DefUpvar(_, nid, _, _) => {
|
||||||
// Can't move upvars, so this is never a ZeroMemLastUse.
|
// Can't move upvars, so this is never a ZeroMemLastUse.
|
||||||
let local_ty = node_id_type(bcx, nid);
|
let local_ty = node_id_type(bcx, nid);
|
||||||
let lval = Lvalue::new_with_hint("expr::trans_local_var (upvar)",
|
let lval = Lvalue::new_with_hint("expr::trans_local_var (upvar)",
|
||||||
@@ -1372,7 +1372,7 @@ pub fn trans_local_var<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
def::DefLocal(nid) => {
|
def::DefLocal(_, nid) => {
|
||||||
let datum = match bcx.fcx.lllocals.borrow().get(&nid) {
|
let datum = match bcx.fcx.lllocals.borrow().get(&nid) {
|
||||||
Some(&v) => v,
|
Some(&v) => v,
|
||||||
None => {
|
None => {
|
||||||
|
|||||||
@@ -4300,7 +4300,7 @@ fn type_scheme_and_predicates_for_def<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
|
|||||||
defn: def::Def)
|
defn: def::Def)
|
||||||
-> (TypeScheme<'tcx>, GenericPredicates<'tcx>) {
|
-> (TypeScheme<'tcx>, GenericPredicates<'tcx>) {
|
||||||
match defn {
|
match defn {
|
||||||
def::DefLocal(nid) | def::DefUpvar(nid, _, _) => {
|
def::DefLocal(_, nid) | def::DefUpvar(_, nid, _, _) => {
|
||||||
let typ = fcx.local_ty(sp, nid);
|
let typ = fcx.local_ty(sp, nid);
|
||||||
(ty::TypeScheme { generics: ty::Generics::empty(), ty: typ },
|
(ty::TypeScheme { generics: ty::Generics::empty(), ty: typ },
|
||||||
ty::GenericPredicates::empty())
|
ty::GenericPredicates::empty())
|
||||||
|
|||||||
Reference in New Issue
Block a user