about summary refs log tree commit diff
path: root/src/librustc/ich
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-03-19 05:07:27 +0000
committerbors <bors@rust-lang.org>2018-03-19 05:07:27 +0000
commit15add366faac554db51244d1e27e4d10a08ab6e8 (patch)
tree1a8018ebe0c906980d6c8fc5f0f739368cd05389 /src/librustc/ich
parent152217d29cc842d9a7577e9361f5960f87dcdf5c (diff)
parentf02dc74c2cf1afb049f8978c885589a26fb6676b (diff)
downloadrust-15add366faac554db51244d1e27e4d10a08ab6e8.tar.gz
rust-15add366faac554db51244d1e27e4d10a08ab6e8.zip
Auto merge of #49091 - nikomatsakis:issue-49043-ty-infer-hash, r=michaelwoerister
extend stable hasher to support `CanonicalTy`

Fixes #49043

r? @michaelwoerister
Diffstat (limited to 'src/librustc/ich')
-rw-r--r--src/librustc/ich/impls_ty.rs50
1 files changed, 48 insertions, 2 deletions
diff --git a/src/librustc/ich/impls_ty.rs b/src/librustc/ich/impls_ty.rs
index 7f91bbd6ea2..9a442e05299 100644
--- a/src/librustc/ich/impls_ty.rs
+++ b/src/librustc/ich/impls_ty.rs
@@ -902,13 +902,59 @@ for ty::TypeVariants<'gcx>
             TyForeign(def_id) => {
                 def_id.hash_stable(hcx, hasher);
             }
-            TyInfer(..) => {
-                bug!("ty::TypeVariants::hash_stable() - Unexpected variant {:?}.", *self)
+            TyInfer(infer_ty) => {
+                infer_ty.hash_stable(hcx, hasher);
             }
         }
     }
 }
 
+impl_stable_hash_for!(enum ty::InferTy {
+    TyVar(a),
+    IntVar(a),
+    FloatVar(a),
+    FreshTy(a),
+    FreshIntTy(a),
+    FreshFloatTy(a),
+    CanonicalTy(a),
+});
+
+impl<'a, 'gcx> HashStable<StableHashingContext<'a>>
+for ty::TyVid
+{
+    fn hash_stable<W: StableHasherResult>(&self,
+                                          _hcx: &mut StableHashingContext<'a>,
+                                          _hasher: &mut StableHasher<W>) {
+        // TyVid values are confined to an inference context and hence
+        // should not be hashed.
+        bug!("ty::TypeVariants::hash_stable() - can't hash a TyVid {:?}.", *self)
+    }
+}
+
+impl<'a, 'gcx> HashStable<StableHashingContext<'a>>
+for ty::IntVid
+{
+    fn hash_stable<W: StableHasherResult>(&self,
+                                          _hcx: &mut StableHashingContext<'a>,
+                                          _hasher: &mut StableHasher<W>) {
+        // IntVid values are confined to an inference context and hence
+        // should not be hashed.
+        bug!("ty::TypeVariants::hash_stable() - can't hash an IntVid {:?}.", *self)
+    }
+}
+
+impl<'a, 'gcx> HashStable<StableHashingContext<'a>>
+for ty::FloatVid
+{
+    fn hash_stable<W: StableHasherResult>(&self,
+                                          _hcx: &mut StableHashingContext<'a>,
+                                          _hasher: &mut StableHasher<W>) {
+        // FloatVid values are confined to an inference context and hence
+        // should not be hashed.
+        bug!("ty::TypeVariants::hash_stable() - can't hash a FloatVid {:?}.", *self)
+    }
+}
+
 impl_stable_hash_for!(struct ty::ParamTy {
     idx,
     name