Skip to content

Commit 7853b78

Browse files
committed
Some more refactoring.
Change the key of UpvarListMap from DefId to ast::NodeId
1 parent 410b529 commit 7853b78

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/librustc/ty/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,8 +589,6 @@ impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for ty::TyS<'gcx> {
589589

590590
pub type Ty<'tcx> = &'tcx TyS<'tcx>;
591591

592-
pub type UpvarListMap<'tcx> = FxHashMap<DefId, Vec<UpvarId>>;
593-
594592
impl<'tcx> serialize::UseSpecializedEncodable for Ty<'tcx> {}
595593
impl<'tcx> serialize::UseSpecializedDecodable for Ty<'tcx> {}
596594

@@ -810,6 +808,7 @@ pub struct UpvarBorrow<'tcx> {
810808
pub region: ty::Region<'tcx>,
811809
}
812810

811+
pub type UpvarListMap<'tcx> = FxHashMap<ast::NodeId, Vec<UpvarId>>;
813812
pub type UpvarCaptureMap<'tcx> = FxHashMap<UpvarId, UpvarCapture<'tcx>>;
814813

815814
#[derive(Copy, Clone)]

src/librustc_mir/build/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,7 @@ fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>,
642642
let tcx = hir.tcx();
643643
let span = tcx.hir().span(fn_id);
644644

645+
// hir.tables().upvar_list[fn_id].
645646
// Gather the upvars of a closure, if any.
646647
let upvar_decls: Vec<_> = tcx.with_freevars(fn_id, |freevars| {
647648
freevars.iter().map(|fv| {

src/librustc_typeck/check/upvar.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
159159
self.tables
160160
.borrow_mut()
161161
.upvar_list
162-
.insert(closure_def_id, freevar_list);
162+
.insert(closure_node_id, freevar_list);
163163
});
164164

165165
let body_owner_def_id = self.tcx.hir().body_owner_def_id(body.id());

0 commit comments

Comments
 (0)