diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2025-02-17 21:16:08 -0500 |
|---|---|---|
| committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2025-02-17 21:35:52 -0500 |
| commit | 9fc759099b20993e17a911e2fc7ffec83042b6f1 (patch) | |
| tree | a4c1fd30e2f4ed43e3092d6ca63bead59159e4a9 /compiler/rustc_data_structures/src | |
| parent | ce36a966c79e109dabeef7a47fe68e5294c6d71e (diff) | |
| download | rust-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.rs | 5 |
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. |
