Some more refactoring.

Change the key of UpvarListMap from DefId to ast::NodeId
This commit is contained in:
Blitzerr 2018-12-21 20:00:11 -08:00
parent 410b52958d
commit 7853b780fc
3 changed files with 3 additions and 3 deletions

View file

@ -589,8 +589,6 @@ impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for ty::TyS<'gcx> {
pub type Ty<'tcx> = &'tcx TyS<'tcx>;
pub type UpvarListMap<'tcx> = FxHashMap<DefId, Vec<UpvarId>>;
impl<'tcx> serialize::UseSpecializedEncodable for Ty<'tcx> {}
impl<'tcx> serialize::UseSpecializedDecodable for Ty<'tcx> {}
@ -810,6 +808,7 @@ pub struct UpvarBorrow<'tcx> {
pub region: ty::Region<'tcx>,
}
pub type UpvarListMap<'tcx> = FxHashMap<ast::NodeId, Vec<UpvarId>>;
pub type UpvarCaptureMap<'tcx> = FxHashMap<UpvarId, UpvarCapture<'tcx>>;
#[derive(Copy, Clone)]

View file

@ -642,6 +642,7 @@ fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>,
let tcx = hir.tcx();
let span = tcx.hir().span(fn_id);
// hir.tables().upvar_list[fn_id].
// Gather the upvars of a closure, if any.
let upvar_decls: Vec<_> = tcx.with_freevars(fn_id, |freevars| {
freevars.iter().map(|fv| {

View file

@ -159,7 +159,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
self.tables
.borrow_mut()
.upvar_list
.insert(closure_def_id, freevar_list);
.insert(closure_node_id, freevar_list);
});
let body_owner_def_id = self.tcx.hir().body_owner_def_id(body.id());