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::feature_gate;
|
||||||
use syntax::token;
|
use syntax::token;
|
||||||
use syntax::tokenstream;
|
use syntax::tokenstream;
|
||||||
use syntax_pos::symbol::SymbolStr;
|
|
||||||
use syntax_pos::SourceFile;
|
use syntax_pos::SourceFile;
|
||||||
|
|
||||||
use crate::hir::def_id::{DefId, CrateNum, CRATE_DEF_INDEX};
|
use crate::hir::def_id::{DefId, CrateNum, CRATE_DEF_INDEX};
|
||||||
|
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey, StableHasher};
|
use rustc_data_structures::stable_hasher::{HashStable, 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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl_stable_hash_for!(enum ::syntax_pos::hygiene::MacroKind {
|
impl_stable_hash_for!(enum ::syntax_pos::hygiene::MacroKind {
|
||||||
Bang,
|
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.
|
// The `&'static str`s in this type actually point into the arena.
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Interner {
|
pub struct Interner {
|
||||||
|
|
Loading…
Reference in a new issue