diff options
| -rw-r--r-- | src/librustc/ty/context.rs | 18 | ||||
| -rw-r--r-- | src/librustc_typeck/check/writeback.rs | 14 |
2 files changed, 6 insertions, 26 deletions
diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 46c99f79ece..c60471c285d 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -51,7 +51,7 @@ use ty::steal::Steal; use ty::BindingMode; use ty::CanonicalTy; use ty::CanonicalPolyFnSig; -use util::nodemap::{DefIdSet, ItemLocalMap}; +use util::nodemap::{DefIdMap, DefIdSet, ItemLocalMap}; use util::nodemap::{FxHashMap, FxHashSet}; use smallvec::SmallVec; use rustc_data_structures::stable_hasher::{HashStable, hash_stable_hashmap, @@ -362,7 +362,7 @@ pub struct TypeckTables<'tcx> { /// Stores the canonicalized types provided by the user. See also /// `AscribeUserType` statement in MIR. - user_provided_sigs: ItemLocalMap<CanonicalPolyFnSig<'tcx>>, + pub user_provided_sigs: DefIdMap<CanonicalPolyFnSig<'tcx>>, /// Stores the substitutions that the user explicitly gave (if any) /// attached to `id`. These will not include any inferred @@ -519,20 +519,6 @@ impl<'tcx> TypeckTables<'tcx> { } } - pub fn user_provided_sigs(&self) -> LocalTableInContext<'_, CanonicalPolyFnSig<'tcx>> { - LocalTableInContext { - local_id_root: self.local_id_root, - data: &self.user_provided_sigs - } - } - - pub fn user_provided_sigs_mut(&mut self) -> LocalTableInContextMut<'_, CanonicalPolyFnSig<'tcx>> { - LocalTableInContextMut { - local_id_root: self.local_id_root, - data: &mut self.user_provided_sigs - } - } - pub fn node_types(&self) -> LocalTableInContext<'_, Ty<'tcx>> { LocalTableInContext { local_id_root: self.local_id_root, diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs index d81b600d9be..d968bf222aa 100644 --- a/src/librustc_typeck/check/writeback.rs +++ b/src/librustc_typeck/check/writeback.rs @@ -392,27 +392,21 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> { fn visit_user_provided_sigs(&mut self) { let fcx_tables = self.fcx.tables.borrow(); debug_assert_eq!(fcx_tables.local_id_root, self.tables.local_id_root); - let common_local_id_root = fcx_tables.local_id_root.unwrap(); - - for (&local_id, c_sig) in fcx_tables.user_provided_sigs().iter() { - let hir_id = hir::HirId { - owner: common_local_id_root.index, - local_id, - }; + for (&def_id, c_sig) in fcx_tables.user_provided_sigs.iter() { let c_sig = if let Some(c_sig) = self.tcx().lift_to_global(c_sig) { c_sig } else { span_bug!( - hir_id.to_span(&self.fcx.tcx), + self.fcx.tcx.hir.span_if_local(def_id).unwrap(), "writeback: `{:?}` missing from the global type context", c_sig ); }; self.tables - .user_provided_sigs_mut() - .insert(hir_id, c_sig.clone()); + .user_provided_sigs + .insert(def_id, c_sig.clone()); } } |
