diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2019-11-09 21:17:21 +0100 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2019-11-17 22:37:09 +0100 |
| commit | 1dd5133dce33fed1cffea9bc6fb6ee4f37dc7053 (patch) | |
| tree | 2e33fd85d9a423e6816a7dbc826a361da44397e0 /src/libsyntax_pos | |
| parent | 05f5f76b3b2b225420d81b5ad632e4aadd882595 (diff) | |
Move impl HashStable for Symbol in libsyntax_pos.
Diffstat (limited to 'src/libsyntax_pos')
| -rw-r--r-- | src/libsyntax_pos/symbol.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs index 63368831614..f6377633857 100644 --- a/src/libsyntax_pos/symbol.rs +++ b/src/libsyntax_pos/symbol.rs @@ -940,6 +940,22 @@ impl Decodable for Symbol { } } +impl<CTX> HashStable<CTX> for Symbol { + #[inline] + fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher) { + self.as_str().hash_stable(hcx, hasher); + } +} + +impl<CTX> ToStableHashKey<CTX> for Symbol { + type KeyType = SymbolStr; + + #[inline] + fn to_stable_hash_key(&self, _: &CTX) -> SymbolStr { + self.as_str() + } +} + // The `&'static str`s in this type actually point into the arena. #[derive(Default)] pub struct Interner { |
