about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src
diff options
context:
space:
mode:
authorMark Rousskov <mark.simulacrum@gmail.com>2025-02-17 21:16:08 -0500
committerMark Rousskov <mark.simulacrum@gmail.com>2025-02-17 21:35:52 -0500
commit9fc759099b20993e17a911e2fc7ffec83042b6f1 (patch)
treea4c1fd30e2f4ed43e3092d6ca63bead59159e4a9 /compiler/rustc_data_structures/src
parentce36a966c79e109dabeef7a47fe68e5294c6d71e (diff)
downloadrust-9fc759099b20993e17a911e2fc7ffec83042b6f1.tar.gz
rust-9fc759099b20993e17a911e2fc7ffec83042b6f1.zip
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...).
Diffstat (limited to 'compiler/rustc_data_structures/src')
-rw-r--r--compiler/rustc_data_structures/src/intern.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_data_structures/src/intern.rs b/compiler/rustc_data_structures/src/intern.rs
index 850b052f564..8079212fac5 100644
--- a/compiler/rustc_data_structures/src/intern.rs
+++ b/compiler/rustc_data_structures/src/intern.rs
@@ -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.