diff --git a/src/librustc/ich/impls_ty.rs b/src/librustc/ich/impls_ty.rs index 740b4c428dc1..84058119b459 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 5ec39b78e307..f09488ebcfa6 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>>, + pub fru_field_types: ItemLocalMap>>, /// 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 ea9a19c83782..30f7378e83b1 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 0d484d2ce369..60930d8184a3 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 499afe62b4f9..45ec788b1b8d 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); } }