11use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher , ToStableHashKey } ;
22
33use crate :: hir:: {
4- AttributeMap , BodyId , Crate , Expr , ForeignItem , ForeignItemId , ImplItem , ImplItemId , Item ,
5- ItemId , OwnerNodes , TraitCandidate , TraitItem , TraitItemId , Ty , VisibilityKind ,
4+ AttributeMap , BodyId , Crate , Expr , ForeignItemId , ImplItemId , ItemId , OwnerNodes , TraitItemId ,
5+ Ty ,
66} ;
77use crate :: hir_id:: { HirId , ItemLocalId } ;
88use rustc_span:: def_id:: DefPathHash ;
@@ -13,14 +13,9 @@ use rustc_span::def_id::DefPathHash;
1313pub trait HashStableContext :
1414 rustc_ast:: HashStableContext + rustc_target:: HashStableContext
1515{
16- fn hash_hir_id ( & mut self , _: HirId , hasher : & mut StableHasher ) ;
1716 fn hash_body_id ( & mut self , _: BodyId , hasher : & mut StableHasher ) ;
18- fn hash_reference_to_item ( & mut self , _: HirId , hasher : & mut StableHasher ) ;
1917 fn hash_hir_expr ( & mut self , _: & Expr < ' _ > , hasher : & mut StableHasher ) ;
2018 fn hash_hir_ty ( & mut self , _: & Ty < ' _ > , hasher : & mut StableHasher ) ;
21- fn hash_hir_visibility_kind ( & mut self , _: & VisibilityKind < ' _ > , hasher : & mut StableHasher ) ;
22- fn hash_hir_item_like < F : FnOnce ( & mut Self ) > ( & mut self , f : F ) ;
23- fn hash_hir_trait_candidate ( & mut self , _: & TraitCandidate , hasher : & mut StableHasher ) ;
2419}
2520
2621impl < HirCtx : crate :: HashStableContext > ToStableHashKey < HirCtx > for HirId {
@@ -88,12 +83,6 @@ impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for ForeignItemId
8883 }
8984}
9085
91- impl < HirCtx : crate :: HashStableContext > HashStable < HirCtx > for HirId {
92- fn hash_stable ( & self , hcx : & mut HirCtx , hasher : & mut StableHasher ) {
93- hcx. hash_hir_id ( * self , hasher)
94- }
95- }
96-
9786impl < HirCtx : crate :: HashStableContext > HashStable < HirCtx > for BodyId {
9887 fn hash_stable ( & self , hcx : & mut HirCtx , hasher : & mut StableHasher ) {
9988 hcx. hash_body_id ( * self , hasher)
@@ -107,30 +96,6 @@ impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for BodyId {
10796// want to pick up on a reference changing its target, so we hash the NodeIds
10897// in "DefPath Mode".
10998
110- impl < HirCtx : crate :: HashStableContext > HashStable < HirCtx > for ItemId {
111- fn hash_stable ( & self , hcx : & mut HirCtx , hasher : & mut StableHasher ) {
112- hcx. hash_reference_to_item ( self . hir_id ( ) , hasher)
113- }
114- }
115-
116- impl < HirCtx : crate :: HashStableContext > HashStable < HirCtx > for ForeignItemId {
117- fn hash_stable ( & self , hcx : & mut HirCtx , hasher : & mut StableHasher ) {
118- hcx. hash_reference_to_item ( self . hir_id ( ) , hasher)
119- }
120- }
121-
122- impl < HirCtx : crate :: HashStableContext > HashStable < HirCtx > for ImplItemId {
123- fn hash_stable ( & self , hcx : & mut HirCtx , hasher : & mut StableHasher ) {
124- hcx. hash_reference_to_item ( self . hir_id ( ) , hasher)
125- }
126- }
127-
128- impl < HirCtx : crate :: HashStableContext > HashStable < HirCtx > for TraitItemId {
129- fn hash_stable ( & self , hcx : & mut HirCtx , hasher : & mut StableHasher ) {
130- hcx. hash_reference_to_item ( self . hir_id ( ) , hasher)
131- }
132- }
133-
13499impl < HirCtx : crate :: HashStableContext > HashStable < HirCtx > for Expr < ' _ > {
135100 fn hash_stable ( & self , hcx : & mut HirCtx , hasher : & mut StableHasher ) {
136101 hcx. hash_hir_expr ( self , hasher)
@@ -143,65 +108,6 @@ impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for Ty<'_> {
143108 }
144109}
145110
146- impl < HirCtx : crate :: HashStableContext > HashStable < HirCtx > for VisibilityKind < ' _ > {
147- fn hash_stable ( & self , hcx : & mut HirCtx , hasher : & mut StableHasher ) {
148- hcx. hash_hir_visibility_kind ( self , hasher)
149- }
150- }
151-
152- impl < HirCtx : crate :: HashStableContext > HashStable < HirCtx > for TraitItem < ' _ > {
153- fn hash_stable ( & self , hcx : & mut HirCtx , hasher : & mut StableHasher ) {
154- let TraitItem { def_id : _, ident, ref generics, ref kind, span } = * self ;
155-
156- hcx. hash_hir_item_like ( |hcx| {
157- ident. name . hash_stable ( hcx, hasher) ;
158- generics. hash_stable ( hcx, hasher) ;
159- kind. hash_stable ( hcx, hasher) ;
160- span. hash_stable ( hcx, hasher) ;
161- } ) ;
162- }
163- }
164-
165- impl < HirCtx : crate :: HashStableContext > HashStable < HirCtx > for ImplItem < ' _ > {
166- fn hash_stable ( & self , hcx : & mut HirCtx , hasher : & mut StableHasher ) {
167- let ImplItem { def_id : _, ident, ref vis, ref generics, ref kind, span } = * self ;
168-
169- hcx. hash_hir_item_like ( |hcx| {
170- ident. name . hash_stable ( hcx, hasher) ;
171- vis. hash_stable ( hcx, hasher) ;
172- generics. hash_stable ( hcx, hasher) ;
173- kind. hash_stable ( hcx, hasher) ;
174- span. hash_stable ( hcx, hasher) ;
175- } ) ;
176- }
177- }
178-
179- impl < HirCtx : crate :: HashStableContext > HashStable < HirCtx > for ForeignItem < ' _ > {
180- fn hash_stable ( & self , hcx : & mut HirCtx , hasher : & mut StableHasher ) {
181- let ForeignItem { def_id : _, ident, ref kind, span, ref vis } = * self ;
182-
183- hcx. hash_hir_item_like ( |hcx| {
184- ident. name . hash_stable ( hcx, hasher) ;
185- kind. hash_stable ( hcx, hasher) ;
186- span. hash_stable ( hcx, hasher) ;
187- vis. hash_stable ( hcx, hasher) ;
188- } ) ;
189- }
190- }
191-
192- impl < HirCtx : crate :: HashStableContext > HashStable < HirCtx > for Item < ' _ > {
193- fn hash_stable ( & self , hcx : & mut HirCtx , hasher : & mut StableHasher ) {
194- let Item { ident, def_id : _, ref kind, ref vis, span } = * self ;
195-
196- hcx. hash_hir_item_like ( |hcx| {
197- ident. name . hash_stable ( hcx, hasher) ;
198- kind. hash_stable ( hcx, hasher) ;
199- vis. hash_stable ( hcx, hasher) ;
200- span. hash_stable ( hcx, hasher) ;
201- } ) ;
202- }
203- }
204-
205111impl < ' tcx , HirCtx : crate :: HashStableContext > HashStable < HirCtx > for OwnerNodes < ' tcx > {
206112 fn hash_stable ( & self , hcx : & mut HirCtx , hasher : & mut StableHasher ) {
207113 // We ignore the `nodes` and `bodies` fields since these refer to information included in
@@ -235,9 +141,3 @@ impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for Crate<'_> {
235141 hir_hash. hash_stable ( hcx, hasher)
236142 }
237143}
238-
239- impl < HirCtx : crate :: HashStableContext > HashStable < HirCtx > for TraitCandidate {
240- fn hash_stable ( & self , hcx : & mut HirCtx , hasher : & mut StableHasher ) {
241- hcx. hash_hir_trait_candidate ( self , hasher)
242- }
243- }
0 commit comments