@@ -33,9 +33,9 @@ use rustc_data_structures::accumulate_vec::AccumulateVec;
33
33
/// enough information to transform DefIds and HirIds into stable DefPaths (i.e.
34
34
/// a reference to the TyCtxt) and it holds a few caches for speeding up various
35
35
/// things (e.g. each DefId/DefPath is only hashed once).
36
- pub struct StableHashingContext < ' a , ' tcx : ' a > {
37
- tcx : ty:: TyCtxt < ' a , ' tcx , ' tcx > ,
38
- codemap : CachingCodemapView < ' tcx > ,
36
+ pub struct StableHashingContext < ' a , ' gcx : ' a + ' tcx , ' tcx : ' a > {
37
+ tcx : ty:: TyCtxt < ' a , ' gcx , ' tcx > ,
38
+ codemap : CachingCodemapView < ' gcx > ,
39
39
hash_spans : bool ,
40
40
hash_bodies : bool ,
41
41
overflow_checks_enabled : bool ,
@@ -51,9 +51,9 @@ pub enum NodeIdHashingMode {
51
51
HashTraitsInScope ,
52
52
}
53
53
54
- impl < ' a , ' tcx : ' a > StableHashingContext < ' a , ' tcx > {
54
+ impl < ' a , ' gcx , ' tcx > StableHashingContext < ' a , ' gcx , ' tcx > {
55
55
56
- pub fn new ( tcx : ty:: TyCtxt < ' a , ' tcx , ' tcx > ) -> Self {
56
+ pub fn new ( tcx : ty:: TyCtxt < ' a , ' gcx , ' tcx > ) -> Self {
57
57
let hash_spans_initial = tcx. sess . opts . debuginfo != NoDebugInfo ;
58
58
let check_overflow_initial = tcx. sess . overflow_checks ( ) ;
59
59
@@ -111,7 +111,7 @@ impl<'a, 'tcx: 'a> StableHashingContext<'a, 'tcx> {
111
111
}
112
112
113
113
#[ inline]
114
- pub fn tcx ( & self ) -> ty:: TyCtxt < ' a , ' tcx , ' tcx > {
114
+ pub fn tcx ( & self ) -> ty:: TyCtxt < ' a , ' gcx , ' tcx > {
115
115
self . tcx
116
116
}
117
117
@@ -131,7 +131,7 @@ impl<'a, 'tcx: 'a> StableHashingContext<'a, 'tcx> {
131
131
}
132
132
133
133
#[ inline]
134
- pub fn codemap ( & mut self ) -> & mut CachingCodemapView < ' tcx > {
134
+ pub fn codemap ( & mut self ) -> & mut CachingCodemapView < ' gcx > {
135
135
& mut self . codemap
136
136
}
137
137
@@ -195,9 +195,9 @@ impl<'a, 'tcx: 'a> StableHashingContext<'a, 'tcx> {
195
195
}
196
196
197
197
198
- impl < ' a , ' tcx > HashStable < StableHashingContext < ' a , ' tcx > > for ast:: NodeId {
198
+ impl < ' a , ' gcx , ' tcx > HashStable < StableHashingContext < ' a , ' gcx , ' tcx > > for ast:: NodeId {
199
199
fn hash_stable < W : StableHasherResult > ( & self ,
200
- hcx : & mut StableHashingContext < ' a , ' tcx > ,
200
+ hcx : & mut StableHashingContext < ' a , ' gcx , ' tcx > ,
201
201
hasher : & mut StableHasher < W > ) {
202
202
match hcx. node_id_hashing_mode {
203
203
NodeIdHashingMode :: Ignore => {
@@ -230,7 +230,7 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a, 'tcx>> for ast::NodeId {
230
230
}
231
231
}
232
232
233
- impl < ' a , ' tcx > HashStable < StableHashingContext < ' a , ' tcx > > for Span {
233
+ impl < ' a , ' gcx , ' tcx > HashStable < StableHashingContext < ' a , ' gcx , ' tcx > > for Span {
234
234
235
235
// Hash a span in a stable way. We can't directly hash the span's BytePos
236
236
// fields (that would be similar to hashing pointers, since those are just
@@ -242,7 +242,7 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a, 'tcx>> for Span {
242
242
// Also, hashing filenames is expensive so we avoid doing it twice when the
243
243
// span starts and ends in the same file, which is almost always the case.
244
244
fn hash_stable < W : StableHasherResult > ( & self ,
245
- hcx : & mut StableHashingContext < ' a , ' tcx > ,
245
+ hcx : & mut StableHashingContext < ' a , ' gcx , ' tcx > ,
246
246
hasher : & mut StableHasher < W > ) {
247
247
use syntax_pos:: Pos ;
248
248
@@ -305,15 +305,16 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a, 'tcx>> for Span {
305
305
}
306
306
}
307
307
308
- pub fn hash_stable_hashmap < ' a , ' tcx , K , V , R , SK , F , W > ( hcx : & mut StableHashingContext < ' a , ' tcx > ,
309
- hasher : & mut StableHasher < W > ,
310
- map : & HashMap < K , V , R > ,
311
- extract_stable_key : F )
308
+ pub fn hash_stable_hashmap < ' a , ' gcx , ' tcx , K , V , R , SK , F , W > (
309
+ hcx : & mut StableHashingContext < ' a , ' gcx , ' tcx > ,
310
+ hasher : & mut StableHasher < W > ,
311
+ map : & HashMap < K , V , R > ,
312
+ extract_stable_key : F )
312
313
where K : Eq + std_hash:: Hash ,
313
- V : HashStable < StableHashingContext < ' a , ' tcx > > ,
314
+ V : HashStable < StableHashingContext < ' a , ' gcx , ' tcx > > ,
314
315
R : std_hash:: BuildHasher ,
315
- SK : HashStable < StableHashingContext < ' a , ' tcx > > + Ord + Clone ,
316
- F : Fn ( & mut StableHashingContext < ' a , ' tcx > , & K ) -> SK ,
316
+ SK : HashStable < StableHashingContext < ' a , ' gcx , ' tcx > > + Ord + Clone ,
317
+ F : Fn ( & mut StableHashingContext < ' a , ' gcx , ' tcx > , & K ) -> SK ,
317
318
W : StableHasherResult ,
318
319
{
319
320
let mut keys: Vec < _ > = map. keys ( )
@@ -327,14 +328,15 @@ pub fn hash_stable_hashmap<'a, 'tcx, K, V, R, SK, F, W>(hcx: &mut StableHashingC
327
328
}
328
329
}
329
330
330
- pub fn hash_stable_hashset < ' a , ' tcx , K , R , SK , F , W > ( hcx : & mut StableHashingContext < ' a , ' tcx > ,
331
- hasher : & mut StableHasher < W > ,
332
- set : & HashSet < K , R > ,
333
- extract_stable_key : F )
331
+ pub fn hash_stable_hashset < ' a , ' tcx , ' gcx , K , R , SK , F , W > (
332
+ hcx : & mut StableHashingContext < ' a , ' gcx , ' tcx > ,
333
+ hasher : & mut StableHasher < W > ,
334
+ set : & HashSet < K , R > ,
335
+ extract_stable_key : F )
334
336
where K : Eq + std_hash:: Hash ,
335
337
R : std_hash:: BuildHasher ,
336
- SK : HashStable < StableHashingContext < ' a , ' tcx > > + Ord + Clone ,
337
- F : Fn ( & mut StableHashingContext < ' a , ' tcx > , & K ) -> SK ,
338
+ SK : HashStable < StableHashingContext < ' a , ' gcx , ' tcx > > + Ord + Clone ,
339
+ F : Fn ( & mut StableHashingContext < ' a , ' gcx , ' tcx > , & K ) -> SK ,
338
340
W : StableHasherResult ,
339
341
{
340
342
let mut keys: Vec < _ > = set. iter ( )
@@ -344,10 +346,11 @@ pub fn hash_stable_hashset<'a, 'tcx, K, R, SK, F, W>(hcx: &mut StableHashingCont
344
346
keys. hash_stable ( hcx, hasher) ;
345
347
}
346
348
347
- pub fn hash_stable_nodemap < ' a , ' tcx , V , W > ( hcx : & mut StableHashingContext < ' a , ' tcx > ,
348
- hasher : & mut StableHasher < W > ,
349
- map : & NodeMap < V > )
350
- where V : HashStable < StableHashingContext < ' a , ' tcx > > ,
349
+ pub fn hash_stable_nodemap < ' a , ' tcx , ' gcx , V , W > (
350
+ hcx : & mut StableHashingContext < ' a , ' gcx , ' tcx > ,
351
+ hasher : & mut StableHasher < W > ,
352
+ map : & NodeMap < V > )
353
+ where V : HashStable < StableHashingContext < ' a , ' gcx , ' tcx > > ,
351
354
W : StableHasherResult ,
352
355
{
353
356
hash_stable_hashmap ( hcx, hasher, map, |hcx, node_id| {
@@ -356,14 +359,15 @@ pub fn hash_stable_nodemap<'a, 'tcx, V, W>(hcx: &mut StableHashingContext<'a, 't
356
359
}
357
360
358
361
359
- pub fn hash_stable_btreemap < ' a , ' tcx , K , V , SK , F , W > ( hcx : & mut StableHashingContext < ' a , ' tcx > ,
360
- hasher : & mut StableHasher < W > ,
361
- map : & BTreeMap < K , V > ,
362
- extract_stable_key : F )
362
+ pub fn hash_stable_btreemap < ' a , ' tcx , ' gcx , K , V , SK , F , W > (
363
+ hcx : & mut StableHashingContext < ' a , ' gcx , ' tcx > ,
364
+ hasher : & mut StableHasher < W > ,
365
+ map : & BTreeMap < K , V > ,
366
+ extract_stable_key : F )
363
367
where K : Eq + Ord ,
364
- V : HashStable < StableHashingContext < ' a , ' tcx > > ,
365
- SK : HashStable < StableHashingContext < ' a , ' tcx > > + Ord + Clone ,
366
- F : Fn ( & mut StableHashingContext < ' a , ' tcx > , & K ) -> SK ,
368
+ V : HashStable < StableHashingContext < ' a , ' gcx , ' tcx > > ,
369
+ SK : HashStable < StableHashingContext < ' a , ' gcx , ' tcx > > + Ord + Clone ,
370
+ F : Fn ( & mut StableHashingContext < ' a , ' gcx , ' tcx > , & K ) -> SK ,
367
371
W : StableHasherResult ,
368
372
{
369
373
let mut keys: Vec < _ > = map. keys ( )
0 commit comments