Skip to content

Commit 299dd02

Browse files
committed
update hash_stable for List<Ty<'tcx>>
1 parent 01ad0ad commit 299dd02

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

compiler/rustc_middle/src/ty/impls_ty.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,16 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for ty::subst::GenericArgKin
7373
//
7474
// In order to make it very unlikely for the sequence of bytes being hashed for
7575
// a `GenericArgKind::Type` to be the same as the sequence of bytes being
76-
// hashed for one of the other variants, we hash a `0xFF` byte before hashing
77-
// their discriminant (since the discriminant of `TyKind` is unlikely to ever start
78-
// with 0xFF).
76+
// hashed for one of the other variants, we hash some very high number instead
77+
// of their actual discriminant since `TyKind` should never start with anything
78+
// that high.
7979
ty::subst::GenericArgKind::Type(ty) => ty.hash_stable(hcx, hasher),
8080
ty::subst::GenericArgKind::Const(ct) => {
81-
0xFFu8.hash_stable(hcx, hasher);
82-
mem::discriminant(self).hash_stable(hcx, hasher);
81+
0xF3u8.hash_stable(hcx, hasher).hash_stable(hcx, hasher);
8382
ct.hash_stable(hcx, hasher);
8483
}
8584
ty::subst::GenericArgKind::Lifetime(lt) => {
86-
0xFFu8.hash_stable(hcx, hasher);
87-
mem::discriminant(self).hash_stable(hcx, hasher);
85+
0xF5u8.hash_stable(hcx, hasher);
8886
lt.hash_stable(hcx, hasher);
8987
}
9088
}

0 commit comments

Comments
 (0)