diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index 678ec797a86b..7f7a545df960 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -12,7 +12,7 @@ //! types in no particular order. use hir; -use hir::def_id::DefId; +use hir::def_id::{DefId, CrateNum, CRATE_DEF_INDEX}; use ich::{StableHashingContext, NodeIdHashingMode}; use std::mem; @@ -46,6 +46,19 @@ impl<'a, 'gcx, 'tcx> HashStable> for hir::H } } + +impl<'a, 'gcx, 'tcx> HashStable> for CrateNum { + #[inline] + fn hash_stable(&self, + hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hasher: &mut StableHasher) { + hcx.def_path_hash(DefId { + krate: *self, + index: CRATE_DEF_INDEX + }).hash_stable(hcx, hasher); + } +} + impl_stable_hash_for!(tuple_struct hir::ItemLocalId { index }); // The following implementations of HashStable for ItemId, TraitItemId, and diff --git a/src/librustc_data_structures/stable_hasher.rs b/src/librustc_data_structures/stable_hasher.rs index 635b95d861da..634d3041bf4a 100644 --- a/src/librustc_data_structures/stable_hasher.rs +++ b/src/librustc_data_structures/stable_hasher.rs @@ -244,6 +244,14 @@ impl HashStable for f64 { } } +impl, CTX> HashStable for (T1,) { + fn hash_stable(&self, + ctx: &mut CTX, + hasher: &mut StableHasher) { + self.0.hash_stable(ctx, hasher); + } +} + impl, T2: HashStable, CTX> HashStable for (T1, T2) { fn hash_stable(&self, ctx: &mut CTX, @@ -273,6 +281,24 @@ impl, CTX> HashStable for Vec { } } +impl, CTX> HashStable for ::std::rc::Rc { + #[inline] + fn hash_stable(&self, + ctx: &mut CTX, + hasher: &mut StableHasher) { + (**self).hash_stable(ctx, hasher); + } +} + +impl, CTX> HashStable for ::std::sync::Arc { + #[inline] + fn hash_stable(&self, + ctx: &mut CTX, + hasher: &mut StableHasher) { + (**self).hash_stable(ctx, hasher); + } +} + impl HashStable for str { #[inline] fn hash_stable(&self,