diff --git a/src/librustc/ich/impls_ty.rs b/src/librustc/ich/impls_ty.rs index 74441d469456..4f691c0d3948 100644 --- a/src/librustc/ich/impls_ty.rs +++ b/src/librustc/ich/impls_ty.rs @@ -368,6 +368,17 @@ impl_stable_hash_for!(struct mir::interpret::MemoryPointer { offset }); +enum AllocDiscriminant { + Static, + Constant, + Function, +} +impl_stable_hash_for!(enum self::AllocDiscriminant { + Static, + Constant, + Function +}); + impl<'a> HashStable> for mir::interpret::AllocId { fn hash_stable( &self, @@ -377,15 +388,15 @@ impl<'a> HashStable> for mir::interpret::AllocId { ty::tls::with_opt(|tcx| { let tcx = tcx.expect("can't hash AllocIds during hir lowering"); if let Some(def_id) = tcx.interpret_interner.get_corresponding_static_def_id(*self) { - 0.hash_stable(hcx, hasher); + AllocDiscriminant::Static.hash_stable(hcx, hasher); // statics are unique via their DefId def_id.hash_stable(hcx, hasher); } else if let Some(alloc) = tcx.interpret_interner.get_alloc(*self) { // not a static, can't be recursive, hash the allocation - 1.hash_stable(hcx, hasher); + AllocDiscriminant::Constant.hash_stable(hcx, hasher); alloc.hash_stable(hcx, hasher); } else if let Some(inst) = tcx.interpret_interner.get_fn(*self) { - 2.hash_stable(hcx, hasher); + AllocDiscriminant::Function.hash_stable(hcx, hasher); inst.hash_stable(hcx, hasher); } else { bug!("no allocation for {}", self);