Move impl HashStable for Symbol in libsyntax_pos.
This commit is contained in:
parent
05f5f76b3b
commit
1dd5133dce
2 changed files with 17 additions and 20 deletions
|
@ -10,31 +10,12 @@ use syntax::ast;
|
|||
use syntax::feature_gate;
|
||||
use syntax::token;
|
||||
use syntax::tokenstream;
|
||||
use syntax_pos::symbol::SymbolStr;
|
||||
use syntax_pos::SourceFile;
|
||||
|
||||
use crate::hir::def_id::{DefId, CrateNum, CRATE_DEF_INDEX};
|
||||
|
||||
use smallvec::SmallVec;
|
||||
use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey, StableHasher};
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for ast::Name {
|
||||
#[inline]
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
self.as_str().hash_stable(hcx, hasher);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ToStableHashKey<StableHashingContext<'a>> for ast::Name {
|
||||
type KeyType = SymbolStr;
|
||||
|
||||
#[inline]
|
||||
fn to_stable_hash_key(&self,
|
||||
_: &StableHashingContext<'a>)
|
||||
-> SymbolStr {
|
||||
self.as_str()
|
||||
}
|
||||
}
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
|
||||
impl_stable_hash_for!(enum ::syntax_pos::hygiene::MacroKind {
|
||||
Bang,
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue