Skip to content

Commit 9a9aa5b

Browse files
varkoryodaldevoid
andcommitted
Implement Hash for new types
Co-Authored-By: Gabriel Smith <[email protected]>
1 parent 73a6df6 commit 9a9aa5b

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/librustc/ich/impls_ty.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ for ty::subst::UnpackedKind<'gcx> {
7474
match self {
7575
ty::subst::UnpackedKind::Lifetime(lt) => lt.hash_stable(hcx, hasher),
7676
ty::subst::UnpackedKind::Type(ty) => ty.hash_stable(hcx, hasher),
77+
ty::subst::UnpackedKind::Const(ct) => ct.hash_stable(hcx, hasher),
7778
}
7879
}
7980
}
@@ -134,6 +135,15 @@ impl<'a> HashStable<StableHashingContext<'a>> for ty::RegionVid {
134135
}
135136
}
136137

138+
impl<'gcx, 'tcx> HashStable<StableHashingContext<'gcx>> for ty::ConstVid<'tcx> {
139+
#[inline]
140+
fn hash_stable<W: StableHasherResult>(&self,
141+
hcx: &mut StableHashingContext<'gcx>,
142+
hasher: &mut StableHasher<W>) {
143+
self.index.hash_stable(hcx, hasher);
144+
}
145+
}
146+
137147
impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::BoundVar {
138148
#[inline]
139149
fn hash_stable<W: StableHasherResult>(&self,
@@ -297,6 +307,14 @@ impl<'a> HashStable<StableHashingContext<'a>> for ty::VariantFlags {
297307
}
298308
}
299309

310+
impl_stable_hash_for!(
311+
impl<'tcx> for enum ty::InferConst<'tcx> [ ty::InferConst ] {
312+
Var(vid),
313+
Fresh(i),
314+
Canonical(debruijn, var),
315+
}
316+
);
317+
300318
impl_stable_hash_for!(enum ty::VariantDiscr {
301319
Explicit(def_id),
302320
Relative(distance)
@@ -310,11 +328,14 @@ impl_stable_hash_for!(struct ty::FieldDef {
310328

311329
impl_stable_hash_for!(
312330
impl<'tcx> for enum mir::interpret::ConstValue<'tcx> [ mir::interpret::ConstValue ] {
331+
Param(param),
332+
Infer(infer),
313333
Scalar(val),
314334
Slice(a, b),
315335
ByRef(ptr, alloc),
316336
}
317337
);
338+
318339
impl_stable_hash_for!(struct crate::mir::interpret::RawConst<'tcx> {
319340
alloc_id,
320341
ty,
@@ -518,6 +539,7 @@ impl_stable_hash_for!(struct ty::GenericParamDef {
518539
impl_stable_hash_for!(enum ty::GenericParamDefKind {
519540
Lifetime,
520541
Type { has_default, object_lifetime_default, synthetic },
542+
Const,
521543
});
522544

523545
impl_stable_hash_for!(
@@ -736,6 +758,11 @@ for ty::FloatVid
736758
}
737759
}
738760

761+
impl_stable_hash_for!(struct ty::ParamConst {
762+
index,
763+
name
764+
});
765+
739766
impl_stable_hash_for!(struct ty::ParamTy {
740767
idx,
741768
name

0 commit comments

Comments
 (0)