]> git.lizzy.rs Git - rust.git/commitdiff
Some more refactoring.
authorBlitzerr <rusty.blitzerr@gmail.com>
Sat, 22 Dec 2018 04:00:11 +0000 (20:00 -0800)
committerBlitzerr <rusty.blitzerr@gmail.com>
Wed, 9 Jan 2019 01:57:22 +0000 (17:57 -0800)
Change the key of UpvarListMap from DefId to ast::NodeId

src/librustc/ty/mod.rs
src/librustc_mir/build/mod.rs
src/librustc_typeck/check/upvar.rs

index f770f2bf7b1255fde5888ec76c16b30b5d561c79..8afe0241ac8638db66b3d2e182107398c0b42ecd 100644 (file)
@@ -589,8 +589,6 @@ fn hash_stable<W: StableHasherResult>(&self,
 
 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)]
index 727b769cf4d4443931087f8ea7ef25e716fc81d7..4b0907f808364c749e32146d53da832eb7e77507 100644 (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| {
index 2a50f63b7925bd281eb1bf4f8c444621064c13e3..24d13d9c2acfa3d38b064776aea00f9a27602f9e 100644 (file)
@@ -159,7 +159,7 @@ fn analyze_closure(
             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());