@@ -281,7 +281,7 @@ impl<'a> ToStableHashKey<StableHashingContext<'a>> for ast::NodeId {
281
281
}
282
282
}
283
283
284
- impl < ' a > HashStable < StableHashingContext < ' a > > for Span {
284
+ impl < ' a > syntax_pos :: StableHashingContextLike for StableHashingContext < ' a > {
285
285
/// Hashes a span in a stable way. We can't directly hash the span's `BytePos`
286
286
/// fields (that would be similar to hashing pointers, since those are just
287
287
/// offsets into the `SourceMap`). Instead, we hash the (file name, line, column)
@@ -291,25 +291,25 @@ impl<'a> HashStable<StableHashingContext<'a>> for Span {
291
291
/// codepoint offsets. For the purpose of the hash that's sufficient.
292
292
/// Also, hashing filenames is expensive so we avoid doing it twice when the
293
293
/// span starts and ends in the same file, which is almost always the case.
294
- fn hash_stable ( & self , hcx : & mut StableHashingContext < ' a > , hasher : & mut StableHasher ) {
294
+ fn hash_stable_span ( & mut self , span : & Span , hasher : & mut StableHasher ) {
295
295
const TAG_VALID_SPAN : u8 = 0 ;
296
296
const TAG_INVALID_SPAN : u8 = 1 ;
297
297
const TAG_EXPANSION : u8 = 0 ;
298
298
const TAG_NO_EXPANSION : u8 = 1 ;
299
299
300
- if !hcx . hash_spans {
300
+ if !self . hash_spans {
301
301
return
302
302
}
303
303
304
- if * self == DUMMY_SP {
304
+ if * span == DUMMY_SP {
305
305
return std_hash:: Hash :: hash ( & TAG_INVALID_SPAN , hasher) ;
306
306
}
307
307
308
308
// If this is not an empty or invalid span, we want to hash the last
309
309
// position that belongs to it, as opposed to hashing the first
310
310
// position past it.
311
- let span = self . data ( ) ;
312
- let ( file_lo, line_lo, col_lo) = match hcx . source_map ( )
311
+ let span = span . data ( ) ;
312
+ let ( file_lo, line_lo, col_lo) = match self . source_map ( )
313
313
. byte_pos_to_line_and_col ( span. lo ) {
314
314
Some ( pos) => pos,
315
315
None => {
@@ -333,9 +333,9 @@ impl<'a> HashStable<StableHashingContext<'a>> for Span {
333
333
std_hash:: Hash :: hash ( & line_col_len, hasher) ;
334
334
335
335
if span. ctxt == SyntaxContext :: root ( ) {
336
- TAG_NO_EXPANSION . hash_stable ( hcx , hasher) ;
336
+ TAG_NO_EXPANSION . hash_stable ( self , hasher) ;
337
337
} else {
338
- TAG_EXPANSION . hash_stable ( hcx , hasher) ;
338
+ TAG_EXPANSION . hash_stable ( self , hasher) ;
339
339
340
340
// Since the same expansion context is usually referenced many
341
341
// times, we cache a stable hash of it and hash that instead of
@@ -352,14 +352,14 @@ impl<'a> HashStable<StableHashingContext<'a>> for Span {
352
352
}
353
353
354
354
let mut hasher = StableHasher :: new ( ) ;
355
- expn_id. expn_data ( ) . hash_stable ( hcx , & mut hasher) ;
355
+ expn_id. expn_data ( ) . hash_stable ( self , & mut hasher) ;
356
356
let sub_hash: Fingerprint = hasher. finish ( ) ;
357
357
let sub_hash = sub_hash. to_smaller_hash ( ) ;
358
358
cache. borrow_mut ( ) . insert ( expn_id, sub_hash) ;
359
359
sub_hash
360
360
} ) ;
361
361
362
- sub_hash. hash_stable ( hcx , hasher) ;
362
+ sub_hash. hash_stable ( self , hasher) ;
363
363
}
364
364
}
365
365
}
0 commit comments