File tree Expand file tree Collapse file tree 2 files changed +17
-20
lines changed Expand file tree Collapse file tree 2 files changed +17
-20
lines changed Original file line number Diff line number Diff line change @@ -10,31 +10,12 @@ use syntax::ast;
1010use syntax:: feature_gate;
1111use syntax:: token;
1212use syntax:: tokenstream;
13- use syntax_pos:: symbol:: SymbolStr ;
1413use syntax_pos:: SourceFile ;
1514
1615use crate :: hir:: def_id:: { DefId , CrateNum , CRATE_DEF_INDEX } ;
1716
1817use smallvec:: SmallVec ;
19- use rustc_data_structures:: stable_hasher:: { HashStable , ToStableHashKey , StableHasher } ;
20-
21- impl < ' a > HashStable < StableHashingContext < ' a > > for ast:: Name {
22- #[ inline]
23- fn hash_stable ( & self , hcx : & mut StableHashingContext < ' a > , hasher : & mut StableHasher ) {
24- self . as_str ( ) . hash_stable ( hcx, hasher) ;
25- }
26- }
27-
28- impl < ' a > ToStableHashKey < StableHashingContext < ' a > > for ast:: Name {
29- type KeyType = SymbolStr ;
30-
31- #[ inline]
32- fn to_stable_hash_key ( & self ,
33- _: & StableHashingContext < ' a > )
34- -> SymbolStr {
35- self . as_str ( )
36- }
37- }
18+ use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
3819
3920impl_stable_hash_for ! ( enum :: syntax_pos:: hygiene:: MacroKind {
4021 Bang ,
Original file line number Diff line number Diff line change @@ -940,6 +940,22 @@ impl Decodable for Symbol {
940940 }
941941}
942942
943+ impl < CTX > HashStable < CTX > for Symbol {
944+ #[ inline]
945+ fn hash_stable ( & self , hcx : & mut CTX , hasher : & mut StableHasher ) {
946+ self . as_str ( ) . hash_stable ( hcx, hasher) ;
947+ }
948+ }
949+
950+ impl < CTX > ToStableHashKey < CTX > for Symbol {
951+ type KeyType = SymbolStr ;
952+
953+ #[ inline]
954+ fn to_stable_hash_key ( & self , _: & CTX ) -> SymbolStr {
955+ self . as_str ( )
956+ }
957+ }
958+
943959// The `&'static str`s in this type actually point into the arena.
944960#[ derive( Default ) ]
945961pub struct Interner {
You can’t perform that action at this time.
0 commit comments