Implement Hash for new types
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
This commit is contained in:
parent
73a6df6079
commit
9a9aa5b46a
1 changed files with 27 additions and 0 deletions
|
@ -74,6 +74,7 @@ for ty::subst::UnpackedKind<'gcx> {
|
||||||
match self {
|
match self {
|
||||||
ty::subst::UnpackedKind::Lifetime(lt) => lt.hash_stable(hcx, hasher),
|
ty::subst::UnpackedKind::Lifetime(lt) => lt.hash_stable(hcx, hasher),
|
||||||
ty::subst::UnpackedKind::Type(ty) => ty.hash_stable(hcx, hasher),
|
ty::subst::UnpackedKind::Type(ty) => ty.hash_stable(hcx, hasher),
|
||||||
|
ty::subst::UnpackedKind::Const(ct) => ct.hash_stable(hcx, hasher),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,6 +135,15 @@ impl<'a> HashStable<StableHashingContext<'a>> for ty::RegionVid {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'gcx, 'tcx> HashStable<StableHashingContext<'gcx>> for ty::ConstVid<'tcx> {
|
||||||
|
#[inline]
|
||||||
|
fn hash_stable<W: StableHasherResult>(&self,
|
||||||
|
hcx: &mut StableHashingContext<'gcx>,
|
||||||
|
hasher: &mut StableHasher<W>) {
|
||||||
|
self.index.hash_stable(hcx, hasher);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::BoundVar {
|
impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::BoundVar {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn hash_stable<W: StableHasherResult>(&self,
|
fn hash_stable<W: StableHasherResult>(&self,
|
||||||
|
@ -297,6 +307,14 @@ impl<'a> HashStable<StableHashingContext<'a>> for ty::VariantFlags {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl_stable_hash_for!(
|
||||||
|
impl<'tcx> for enum ty::InferConst<'tcx> [ ty::InferConst ] {
|
||||||
|
Var(vid),
|
||||||
|
Fresh(i),
|
||||||
|
Canonical(debruijn, var),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
impl_stable_hash_for!(enum ty::VariantDiscr {
|
impl_stable_hash_for!(enum ty::VariantDiscr {
|
||||||
Explicit(def_id),
|
Explicit(def_id),
|
||||||
Relative(distance)
|
Relative(distance)
|
||||||
|
@ -310,11 +328,14 @@ impl_stable_hash_for!(struct ty::FieldDef {
|
||||||
|
|
||||||
impl_stable_hash_for!(
|
impl_stable_hash_for!(
|
||||||
impl<'tcx> for enum mir::interpret::ConstValue<'tcx> [ mir::interpret::ConstValue ] {
|
impl<'tcx> for enum mir::interpret::ConstValue<'tcx> [ mir::interpret::ConstValue ] {
|
||||||
|
Param(param),
|
||||||
|
Infer(infer),
|
||||||
Scalar(val),
|
Scalar(val),
|
||||||
Slice(a, b),
|
Slice(a, b),
|
||||||
ByRef(ptr, alloc),
|
ByRef(ptr, alloc),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
impl_stable_hash_for!(struct crate::mir::interpret::RawConst<'tcx> {
|
impl_stable_hash_for!(struct crate::mir::interpret::RawConst<'tcx> {
|
||||||
alloc_id,
|
alloc_id,
|
||||||
ty,
|
ty,
|
||||||
|
@ -518,6 +539,7 @@ impl_stable_hash_for!(struct ty::GenericParamDef {
|
||||||
impl_stable_hash_for!(enum ty::GenericParamDefKind {
|
impl_stable_hash_for!(enum ty::GenericParamDefKind {
|
||||||
Lifetime,
|
Lifetime,
|
||||||
Type { has_default, object_lifetime_default, synthetic },
|
Type { has_default, object_lifetime_default, synthetic },
|
||||||
|
Const,
|
||||||
});
|
});
|
||||||
|
|
||||||
impl_stable_hash_for!(
|
impl_stable_hash_for!(
|
||||||
|
@ -736,6 +758,11 @@ for ty::FloatVid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl_stable_hash_for!(struct ty::ParamConst {
|
||||||
|
index,
|
||||||
|
name
|
||||||
|
});
|
||||||
|
|
||||||
impl_stable_hash_for!(struct ty::ParamTy {
|
impl_stable_hash_for!(struct ty::ParamTy {
|
||||||
idx,
|
idx,
|
||||||
name
|
name
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue