about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Woerister <michaelwoerister@posteo>2017-08-08 12:13:16 +0200
committerMichael Woerister <michaelwoerister@posteo>2017-08-11 12:11:38 +0200
commit801dd07a950b047150aa291e461ba53a7d29489e (patch)
tree459be8aa255046d4ca57c2c3772ce48abe9673b5
parent890f93f8d49f48c32f67519b8e523ce6034cb875 (diff)
downloadrust-801dd07a950b047150aa291e461ba53a7d29489e.tar.gz
rust-801dd07a950b047150aa291e461ba53a7d29489e.zip
Use ItemLocalId as key for TypeckTables::fru_field_types.
-rw-r--r--src/librustc/ich/impls_ty.rs2
-rw-r--r--src/librustc/ty/context.rs4
-rw-r--r--src/librustc_mir/hair/cx/expr.rs5
-rw-r--r--src/librustc_typeck/check/mod.rs5
-rw-r--r--src/librustc_typeck/check/writeback.rs13
5 files changed, 21 insertions, 8 deletions
diff --git a/src/librustc/ich/impls_ty.rs b/src/librustc/ich/impls_ty.rs
index 740b4c428dc..84058119b45 100644
--- a/src/librustc/ich/impls_ty.rs
+++ b/src/librustc/ich/impls_ty.rs
@@ -657,7 +657,7 @@ for ty::TypeckTables<'gcx> {
             ich::hash_stable_itemlocalmap(hcx, hasher, closure_tys);
             ich::hash_stable_itemlocalmap(hcx, hasher, closure_kinds);
             ich::hash_stable_itemlocalmap(hcx, hasher, liberated_fn_sigs);
-            ich::hash_stable_nodemap(hcx, hasher, fru_field_types);
+            ich::hash_stable_itemlocalmap(hcx, hasher, fru_field_types);
             ich::hash_stable_nodemap(hcx, hasher, cast_kinds);
 
             ich::hash_stable_hashset(hcx, hasher, used_trait_imports, |hcx, def_id| {
diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs
index 5ec39b78e30..f09488ebcfa 100644
--- a/src/librustc/ty/context.rs
+++ b/src/librustc/ty/context.rs
@@ -253,7 +253,7 @@ pub struct TypeckTables<'tcx> {
     /// of the struct - this is needed because it is non-trivial to
     /// normalize while preserving regions. This table is used only in
     /// MIR construction and hence is not serialized to metadata.
-    pub fru_field_types: NodeMap<Vec<Ty<'tcx>>>,
+    pub fru_field_types: ItemLocalMap<Vec<Ty<'tcx>>>,
 
     /// Maps a cast expression to its kind. This is keyed on the
     /// *from* expression of the cast, not the cast itself.
@@ -286,7 +286,7 @@ impl<'tcx> TypeckTables<'tcx> {
             closure_tys: ItemLocalMap(),
             closure_kinds: ItemLocalMap(),
             liberated_fn_sigs: ItemLocalMap(),
-            fru_field_types: NodeMap(),
+            fru_field_types: ItemLocalMap(),
             cast_kinds: NodeMap(),
             used_trait_imports: DefIdSet(),
             tainted_by_errors: false,
diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs
index ea9a19c8378..30f7378e83b 100644
--- a/src/librustc_mir/hair/cx/expr.rs
+++ b/src/librustc_mir/hair/cx/expr.rs
@@ -387,9 +387,12 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
                                 substs: substs,
                                 fields: field_refs,
                                 base: base.as_ref().map(|base| {
+                                    cx.tables().validate_hir_id(expr.hir_id);
                                     FruInfo {
                                         base: base.to_ref(),
-                                        field_types: cx.tables().fru_field_types[&expr.id].clone(),
+                                        field_types: cx.tables()
+                                                       .fru_field_types[&expr.hir_id.local_id]
+                                                       .clone(),
                                     }
                                 }),
                             }
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index 0d484d2ce36..60930d8184a 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -3407,7 +3407,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
                     let fru_field_types = adt.struct_variant().fields.iter().map(|f| {
                         self.normalize_associated_types_in(expr.span, &f.ty(self.tcx, substs))
                     }).collect();
-                    self.tables.borrow_mut().fru_field_types.insert(expr.id, fru_field_types);
+
+                    let mut tables = self.tables.borrow_mut();
+                    tables.validate_hir_id(expr.hir_id);
+                    tables.fru_field_types.insert(expr.hir_id.local_id, fru_field_types);
                 }
                 _ => {
                     span_err!(self.tcx.sess, base_expr.span, E0436,
diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs
index 499afe62b4f..45ec788b1b8 100644
--- a/src/librustc_typeck/check/writeback.rs
+++ b/src/librustc_typeck/check/writeback.rs
@@ -362,9 +362,16 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> {
     }
 
     fn visit_fru_field_types(&mut self) {
-        for (&node_id, ftys) in self.fcx.tables.borrow().fru_field_types.iter() {
-            let ftys = self.resolve(ftys, &node_id);
-            self.tables.fru_field_types.insert(node_id, ftys);
+        let fcx_tables = self.fcx.tables.borrow();
+        debug_assert_eq!(fcx_tables.local_id_root, self.tables.local_id_root);
+
+        for (&local_id, ftys) in fcx_tables.fru_field_types.iter() {
+            let hir_id = hir::HirId {
+                owner: fcx_tables.local_id_root.index,
+                local_id,
+            };
+            let ftys = self.resolve(ftys, &hir_id);
+            self.tables.fru_field_types.insert(local_id, ftys);
         }
     }