@@ -281,7 +281,7 @@ impl<'a> ToStableHashKey<StableHashingContext<'a>> for ast::NodeId {
281281 }
282282}
283283
284- impl < ' a > HashStable < StableHashingContext < ' a > > for Span {
284+ impl < ' a > syntax_pos :: StableHashingContextLike for StableHashingContext < ' a > {
285285 /// Hashes a span in a stable way. We can't directly hash the span's `BytePos`
286286 /// fields (that would be similar to hashing pointers, since those are just
287287 /// offsets into the `SourceMap`). Instead, we hash the (file name, line, column)
@@ -291,25 +291,25 @@ impl<'a> HashStable<StableHashingContext<'a>> for Span {
291291 /// codepoint offsets. For the purpose of the hash that's sufficient.
292292 /// Also, hashing filenames is expensive so we avoid doing it twice when the
293293 /// 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 ) {
295295 const TAG_VALID_SPAN : u8 = 0 ;
296296 const TAG_INVALID_SPAN : u8 = 1 ;
297297 const TAG_EXPANSION : u8 = 0 ;
298298 const TAG_NO_EXPANSION : u8 = 1 ;
299299
300- if !hcx . hash_spans {
300+ if !self . hash_spans {
301301 return
302302 }
303303
304- if * self == DUMMY_SP {
304+ if * span == DUMMY_SP {
305305 return std_hash:: Hash :: hash ( & TAG_INVALID_SPAN , hasher) ;
306306 }
307307
308308 // If this is not an empty or invalid span, we want to hash the last
309309 // position that belongs to it, as opposed to hashing the first
310310 // 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 ( )
313313 . byte_pos_to_line_and_col ( span. lo ) {
314314 Some ( pos) => pos,
315315 None => {
@@ -333,9 +333,9 @@ impl<'a> HashStable<StableHashingContext<'a>> for Span {
333333 std_hash:: Hash :: hash ( & line_col_len, hasher) ;
334334
335335 if span. ctxt == SyntaxContext :: root ( ) {
336- TAG_NO_EXPANSION . hash_stable ( hcx , hasher) ;
336+ TAG_NO_EXPANSION . hash_stable ( self , hasher) ;
337337 } else {
338- TAG_EXPANSION . hash_stable ( hcx , hasher) ;
338+ TAG_EXPANSION . hash_stable ( self , hasher) ;
339339
340340 // Since the same expansion context is usually referenced many
341341 // times, we cache a stable hash of it and hash that instead of
@@ -352,14 +352,14 @@ impl<'a> HashStable<StableHashingContext<'a>> for Span {
352352 }
353353
354354 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) ;
356356 let sub_hash: Fingerprint = hasher. finish ( ) ;
357357 let sub_hash = sub_hash. to_smaller_hash ( ) ;
358358 cache. borrow_mut ( ) . insert ( expn_id, sub_hash) ;
359359 sub_hash
360360 } ) ;
361361
362- sub_hash. hash_stable ( hcx , hasher) ;
362+ sub_hash. hash_stable ( self , hasher) ;
363363 }
364364 }
365365}
0 commit comments