Enforce T: Hash for Interned<...>

This adds panicking Hash impls for several resolver types that don't
actually satisfy this condition. It's not obvious to me that
rustc_resolve actually upholds the Interned guarantees but fixing that
seems pretty hard (the structures have at minimum some interior
mutability, so it's not really recursively hashable in place...).
This commit is contained in:
Mark Rousskov 2025-02-17 21:16:08 -05:00
parent ce36a966c7
commit 9fc759099b
3 changed files with 43 additions and 1 deletions

View file

@ -92,7 +92,10 @@ impl<'a, T: Ord> Ord for Interned<'a, T> {
}
}
impl<'a, T> Hash for Interned<'a, T> {
impl<'a, T> Hash for Interned<'a, T>
where
T: Hash,
{
#[inline]
fn hash<H: Hasher>(&self, s: &mut H) {
// Pointer hashing is sufficient, due to the uniqueness constraint.