rewrite the hasher to not access depth field

Co-authored-by: csmoe <35686186+csmoe@users.noreply.github.com>
This commit is contained in:
Niko Matsakis 2018-05-28 09:52:53 -04:00
parent e2f7f4a7b7
commit f965b79ccf
2 changed files with 7 additions and 7 deletions

View File

@ -104,16 +104,16 @@ for ty::RegionKind {
c.hash_stable(hcx, hasher); c.hash_stable(hcx, hasher);
} }
ty::ReLateBound(db, ty::BrAnon(i)) => { ty::ReLateBound(db, ty::BrAnon(i)) => {
db.depth.hash_stable(hcx, hasher); db.hash_stable(hcx, hasher);
i.hash_stable(hcx, hasher); i.hash_stable(hcx, hasher);
} }
ty::ReLateBound(db, ty::BrNamed(def_id, name)) => { ty::ReLateBound(db, ty::BrNamed(def_id, name)) => {
db.depth.hash_stable(hcx, hasher); db.hash_stable(hcx, hasher);
def_id.hash_stable(hcx, hasher); def_id.hash_stable(hcx, hasher);
name.hash_stable(hcx, hasher); name.hash_stable(hcx, hasher);
} }
ty::ReLateBound(db, ty::BrEnv) => { ty::ReLateBound(db, ty::BrEnv) => {
db.depth.hash_stable(hcx, hasher); db.hash_stable(hcx, hasher);
} }
ty::ReEarlyBound(ty::EarlyBoundRegion { def_id, index, name }) => { ty::ReEarlyBound(ty::EarlyBoundRegion { def_id, index, name }) => {
def_id.hash_stable(hcx, hasher); def_id.hash_stable(hcx, hasher);
@ -821,10 +821,6 @@ impl_stable_hash_for!(enum ::middle::resolve_lifetime::Region {
Free(call_site_scope_data, decl) Free(call_site_scope_data, decl)
}); });
impl_stable_hash_for!(struct ty::DebruijnIndex {
depth
});
impl_stable_hash_for!(enum ty::cast::CastKind { impl_stable_hash_for!(enum ty::cast::CastKind {
CoercionCast, CoercionCast,
PtrPtrCast, PtrPtrCast,

View File

@ -1319,6 +1319,10 @@ impl DebruijnIndex {
} }
} }
impl_stable_hash_for!(struct DebruijnIndex {
depth
});
/// Region utilities /// Region utilities
impl RegionKind { impl RegionKind {
pub fn is_late_bound(&self) -> bool { pub fn is_late_bound(&self) -> bool {