// To ensure that both implicit and explicit coercions are
// handled the same way, we insert an extra layer of indirection here.
- // For explicit casts (e.g. 'foo as *const T'), the source of the 'Use'
+ // For explicit casts (e.g., 'foo as *const T'), the source of the 'Use'
// will be an ExprKind::Hair with the appropriate cast expression. Here,
// we make our Use source the generated Cast from the original coercion.
//
// Now comes the rote stuff:
hir::ExprKind::Repeat(ref v, ref count) => {
- let def_id = cx.tcx.hir.local_def_id(count.id);
+ let def_id = cx.tcx.hir().local_def_id(count.id);
let substs = Substs::identity_for_item(cx.tcx.global_tcx(), def_id);
let instance = ty::Instance::resolve(
cx.tcx.global_tcx(),
match dest.target_id {
Ok(target_id) => ExprKind::Break {
label: region::Scope {
- id: cx.tcx.hir.node_to_hir_id(target_id).local_id,
+ id: cx.tcx.hir().node_to_hir_id(target_id).local_id,
data: region::ScopeData::Node
},
value: value.to_ref(),
match dest.target_id {
Ok(loop_id) => ExprKind::Continue {
label: region::Scope {
- id: cx.tcx.hir.node_to_hir_id(loop_id).local_id,
+ id: cx.tcx.hir().node_to_hir_id(loop_id).local_id,
data: region::ScopeData::Node
},
},
var_id,
index,
closure_expr_id);
- let var_hir_id = cx.tcx.hir.node_to_hir_id(var_id);
+ let var_hir_id = cx.tcx.hir().node_to_hir_id(var_id);
let var_ty = cx.tables().node_id_to_type(var_hir_id);
// FIXME free regions in closures are not right
let closure_ty = cx.tables()
- .node_id_to_type(cx.tcx.hir.node_to_hir_id(closure_expr_id));
+ .node_id_to_type(cx.tcx.hir().node_to_hir_id(closure_expr_id));
// FIXME we're just hard-coding the idea that the
// signature will be &self or &mut self and hence will
// have a bound region with number 0
- let closure_def_id = cx.tcx.hir.local_def_id(closure_expr_id);
+ let closure_def_id = cx.tcx.hir().local_def_id(closure_expr_id);
let region = ty::ReFree(ty::FreeRegion {
scope: closure_def_id,
bound_region: ty::BoundRegion::BrAnon(0),
// ...but the upvar might be an `&T` or `&mut T` capture, at which
// point we need an implicit deref
let upvar_id = ty::UpvarId {
- var_id: var_hir_id,
+ var_path: ty::UpvarPath {hir_id: var_hir_id},
closure_expr_id: LocalDefId::from_def_id(closure_def_id),
};
match cx.tables().upvar_capture(upvar_id) {
freevar: &hir::Freevar,
freevar_ty: Ty<'tcx>)
-> ExprRef<'tcx> {
- let var_hir_id = cx.tcx.hir.node_to_hir_id(freevar.var_id());
+ let var_hir_id = cx.tcx.hir().node_to_hir_id(freevar.var_id());
let upvar_id = ty::UpvarId {
- var_id: var_hir_id,
- closure_expr_id: cx.tcx.hir.local_def_id(closure_expr.id).to_local(),
+ var_path: ty::UpvarPath { hir_id: var_hir_id },
+ closure_expr_id: cx.tcx.hir().local_def_id(closure_expr.id).to_local(),
};
let upvar_capture = cx.tables().upvar_capture(upvar_id);
let temp_lifetime = cx.region_scope_tree.temporary_scope(closure_expr.hir_id.local_id);
}
}
-/// Converts a list of named fields (i.e. for struct-like struct/enum ADTs) into FieldExprRef.
+/// Converts a list of named fields (i.e., for struct-like struct/enum ADTs) into FieldExprRef.
fn field_refs<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
fields: &'tcx [hir::Field])
-> Vec<FieldExprRef<'tcx>> {