Skip to content

Commit

Permalink
update hash_stable for List<Ty<'tcx>>
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Mar 10, 2022
1 parent 01ad0ad commit 299dd02
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions compiler/rustc_middle/src/ty/impls_ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,16 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for ty::subst::GenericArgKin
//
// In order to make it very unlikely for the sequence of bytes being hashed for
// a `GenericArgKind::Type` to be the same as the sequence of bytes being
// hashed for one of the other variants, we hash a `0xFF` byte before hashing
// their discriminant (since the discriminant of `TyKind` is unlikely to ever start
// with 0xFF).
// hashed for one of the other variants, we hash some very high number instead
// of their actual discriminant since `TyKind` should never start with anything
// that high.
ty::subst::GenericArgKind::Type(ty) => ty.hash_stable(hcx, hasher),
ty::subst::GenericArgKind::Const(ct) => {
0xFFu8.hash_stable(hcx, hasher);
mem::discriminant(self).hash_stable(hcx, hasher);
0xF3u8.hash_stable(hcx, hasher).hash_stable(hcx, hasher);
ct.hash_stable(hcx, hasher);
}
ty::subst::GenericArgKind::Lifetime(lt) => {
0xFFu8.hash_stable(hcx, hasher);
mem::discriminant(self).hash_stable(hcx, hasher);
0xF5u8.hash_stable(hcx, hasher);
lt.hash_stable(hcx, hasher);
}
}
Expand Down

0 comments on commit 299dd02

Please sign in to comment.