@@ -14,7 +14,7 @@ use hir::map::DefPathHash;
14
14
use hir:: map:: definitions:: Definitions ;
15
15
use ich:: { self , CachingCodemapView , Fingerprint } ;
16
16
use middle:: cstore:: CrateStore ;
17
- use ty:: { TyCtxt , fast_reject, InterpretInterner } ;
17
+ use ty:: { TyCtxt , fast_reject} ;
18
18
use session:: Session ;
19
19
20
20
use std:: cmp:: Ord ;
@@ -44,20 +44,19 @@ thread_local!(static IGNORED_ATTR_NAMES: RefCell<FxHashSet<Symbol>> =
44
44
/// a reference to the TyCtxt) and it holds a few caches for speeding up various
45
45
/// things (e.g. each DefId/DefPath is only hashed once).
46
46
#[ derive( Clone ) ]
47
- pub struct StableHashingContext < ' a , ' gcx : ' a > {
48
- sess : & ' gcx Session ,
49
- definitions : & ' gcx Definitions ,
50
- cstore : & ' gcx CrateStore ,
51
- body_resolver : BodyResolver < ' gcx > ,
47
+ pub struct StableHashingContext < ' a > {
48
+ sess : & ' a Session ,
49
+ definitions : & ' a Definitions ,
50
+ cstore : & ' a CrateStore ,
51
+ body_resolver : BodyResolver < ' a > ,
52
52
hash_spans : bool ,
53
53
hash_bodies : bool ,
54
54
node_id_hashing_mode : NodeIdHashingMode ,
55
- pub interpret_interner : Option < & ' a RefCell < InterpretInterner < ' gcx > > > ,
56
55
57
56
// Very often, we are hashing something that does not need the
58
57
// CachingCodemapView, so we initialize it lazily.
59
- raw_codemap : & ' gcx CodeMap ,
60
- caching_codemap : Option < CachingCodemapView < ' gcx > > ,
58
+ raw_codemap : & ' a CodeMap ,
59
+ caching_codemap : Option < CachingCodemapView < ' a > > ,
61
60
}
62
61
63
62
#[ derive( PartialEq , Eq , Clone , Copy ) ]
@@ -80,15 +79,14 @@ impl<'gcx> BodyResolver<'gcx> {
80
79
}
81
80
}
82
81
83
- impl < ' a , ' gcx > StableHashingContext < ' a , ' gcx > {
82
+ impl < ' a > StableHashingContext < ' a > {
84
83
// The `krate` here is only used for mapping BodyIds to Bodies.
85
84
// Don't use it for anything else or you'll run the risk of
86
85
// leaking data out of the tracking system.
87
- pub fn new ( sess : & ' gcx Session ,
88
- krate : & ' gcx hir:: Crate ,
89
- definitions : & ' gcx Definitions ,
90
- cstore : & ' gcx CrateStore ,
91
- interpret_interner : Option < & ' a RefCell < InterpretInterner < ' gcx > > > )
86
+ pub fn new ( sess : & ' a Session ,
87
+ krate : & ' a hir:: Crate ,
88
+ definitions : & ' a Definitions ,
89
+ cstore : & ' a CrateStore )
92
90
-> Self {
93
91
let hash_spans_initial = !sess. opts . debugging_opts . incremental_ignore_spans ;
94
92
@@ -111,12 +109,11 @@ impl<'a, 'gcx> StableHashingContext<'a, 'gcx> {
111
109
hash_spans : hash_spans_initial,
112
110
hash_bodies : true ,
113
111
node_id_hashing_mode : NodeIdHashingMode :: HashDefPath ,
114
- interpret_interner,
115
112
}
116
113
}
117
114
118
115
#[ inline]
119
- pub fn sess ( & self ) -> & ' gcx Session {
116
+ pub fn sess ( & self ) -> & ' a Session {
120
117
self . sess
121
118
}
122
119
@@ -175,7 +172,7 @@ impl<'a, 'gcx> StableHashingContext<'a, 'gcx> {
175
172
}
176
173
177
174
#[ inline]
178
- pub fn codemap ( & mut self ) -> & mut CachingCodemapView < ' gcx > {
175
+ pub fn codemap ( & mut self ) -> & mut CachingCodemapView < ' a > {
179
176
match self . caching_codemap {
180
177
Some ( ref mut cm) => {
181
178
cm
@@ -205,38 +202,38 @@ impl<'a, 'gcx> StableHashingContext<'a, 'gcx> {
205
202
}
206
203
207
204
impl < ' a , ' gcx , ' lcx > StableHashingContextProvider for TyCtxt < ' a , ' gcx , ' lcx > {
208
- type ContextType = StableHashingContext < ' a , ' gcx > ;
205
+ type ContextType = StableHashingContext < ' a > ;
209
206
fn create_stable_hashing_context ( & self ) -> Self :: ContextType {
210
207
( * self ) . create_stable_hashing_context ( )
211
208
}
212
209
}
213
210
214
211
215
- impl < ' a , ' gcx > StableHashingContextProvider for StableHashingContext < ' a , ' gcx > {
216
- type ContextType = StableHashingContext < ' a , ' gcx > ;
212
+ impl < ' a > StableHashingContextProvider for StableHashingContext < ' a > {
213
+ type ContextType = StableHashingContext < ' a > ;
217
214
fn create_stable_hashing_context ( & self ) -> Self :: ContextType {
218
215
self . clone ( )
219
216
}
220
217
}
221
218
222
- impl < ' a , ' gcx > :: dep_graph:: DepGraphSafe for StableHashingContext < ' a , ' gcx > {
219
+ impl < ' a > :: dep_graph:: DepGraphSafe for StableHashingContext < ' a > {
223
220
}
224
221
225
222
226
- impl < ' a , ' gcx > HashStable < StableHashingContext < ' a , ' gcx > > for hir:: BodyId {
223
+ impl < ' a > HashStable < StableHashingContext < ' a > > for hir:: BodyId {
227
224
fn hash_stable < W : StableHasherResult > ( & self ,
228
- hcx : & mut StableHashingContext < ' a , ' gcx > ,
225
+ hcx : & mut StableHashingContext < ' a > ,
229
226
hasher : & mut StableHasher < W > ) {
230
227
if hcx. hash_bodies ( ) {
231
228
hcx. body_resolver . body ( * self ) . hash_stable ( hcx, hasher) ;
232
229
}
233
230
}
234
231
}
235
232
236
- impl < ' a , ' gcx > HashStable < StableHashingContext < ' a , ' gcx > > for hir:: HirId {
233
+ impl < ' a > HashStable < StableHashingContext < ' a > > for hir:: HirId {
237
234
#[ inline]
238
235
fn hash_stable < W : StableHasherResult > ( & self ,
239
- hcx : & mut StableHashingContext < ' a , ' gcx > ,
236
+ hcx : & mut StableHashingContext < ' a > ,
240
237
hasher : & mut StableHasher < W > ) {
241
238
match hcx. node_id_hashing_mode {
242
239
NodeIdHashingMode :: Ignore => {
@@ -255,21 +252,21 @@ impl<'a, 'gcx> HashStable<StableHashingContext<'a, 'gcx>> for hir::HirId {
255
252
}
256
253
}
257
254
258
- impl < ' a , ' gcx > ToStableHashKey < StableHashingContext < ' a , ' gcx > > for hir:: HirId {
255
+ impl < ' a > ToStableHashKey < StableHashingContext < ' a > > for hir:: HirId {
259
256
type KeyType = ( DefPathHash , hir:: ItemLocalId ) ;
260
257
261
258
#[ inline]
262
259
fn to_stable_hash_key ( & self ,
263
- hcx : & StableHashingContext < ' a , ' gcx > )
260
+ hcx : & StableHashingContext < ' a > )
264
261
-> ( DefPathHash , hir:: ItemLocalId ) {
265
262
let def_path_hash = hcx. local_def_path_hash ( self . owner ) ;
266
263
( def_path_hash, self . local_id )
267
264
}
268
265
}
269
266
270
- impl < ' a , ' gcx > HashStable < StableHashingContext < ' a , ' gcx > > for ast:: NodeId {
267
+ impl < ' a > HashStable < StableHashingContext < ' a > > for ast:: NodeId {
271
268
fn hash_stable < W : StableHasherResult > ( & self ,
272
- hcx : & mut StableHashingContext < ' a , ' gcx > ,
269
+ hcx : & mut StableHashingContext < ' a > ,
273
270
hasher : & mut StableHasher < W > ) {
274
271
match hcx. node_id_hashing_mode {
275
272
NodeIdHashingMode :: Ignore => {
@@ -282,18 +279,18 @@ impl<'a, 'gcx> HashStable<StableHashingContext<'a, 'gcx>> for ast::NodeId {
282
279
}
283
280
}
284
281
285
- impl < ' a , ' gcx > ToStableHashKey < StableHashingContext < ' a , ' gcx > > for ast:: NodeId {
282
+ impl < ' a > ToStableHashKey < StableHashingContext < ' a > > for ast:: NodeId {
286
283
type KeyType = ( DefPathHash , hir:: ItemLocalId ) ;
287
284
288
285
#[ inline]
289
286
fn to_stable_hash_key ( & self ,
290
- hcx : & StableHashingContext < ' a , ' gcx > )
287
+ hcx : & StableHashingContext < ' a > )
291
288
-> ( DefPathHash , hir:: ItemLocalId ) {
292
289
hcx. definitions . node_to_hir_id ( * self ) . to_stable_hash_key ( hcx)
293
290
}
294
291
}
295
292
296
- impl < ' a , ' gcx > HashStable < StableHashingContext < ' a , ' gcx > > for Span {
293
+ impl < ' a > HashStable < StableHashingContext < ' a > > for Span {
297
294
298
295
// Hash a span in a stable way. We can't directly hash the span's BytePos
299
296
// fields (that would be similar to hashing pointers, since those are just
@@ -305,7 +302,7 @@ impl<'a, 'gcx> HashStable<StableHashingContext<'a, 'gcx>> for Span {
305
302
// Also, hashing filenames is expensive so we avoid doing it twice when the
306
303
// span starts and ends in the same file, which is almost always the case.
307
304
fn hash_stable < W : StableHasherResult > ( & self ,
308
- hcx : & mut StableHashingContext < ' a , ' gcx > ,
305
+ hcx : & mut StableHashingContext < ' a > ,
309
306
hasher : & mut StableHasher < W > ) {
310
307
const TAG_VALID_SPAN : u8 = 0 ;
311
308
const TAG_INVALID_SPAN : u8 = 1 ;
@@ -386,7 +383,7 @@ impl<'a, 'gcx> HashStable<StableHashingContext<'a, 'gcx>> for Span {
386
383
}
387
384
388
385
pub fn hash_stable_trait_impls < ' a , ' gcx , W , R > (
389
- hcx : & mut StableHashingContext < ' a , ' gcx > ,
386
+ hcx : & mut StableHashingContext < ' a > ,
390
387
hasher : & mut StableHasher < W > ,
391
388
blanket_impls : & Vec < DefId > ,
392
389
non_blanket_impls : & HashMap < fast_reject:: SimplifiedType , Vec < DefId > , R > )
0 commit comments