@@ -2641,6 +2641,7 @@ where
2641
2641
if def_span. contains ( span) {
2642
2642
// This span is enclosed in a definition: only hash the relative position.
2643
2643
Hash :: hash ( & TAG_RELATIVE_SPAN , hasher) ;
2644
+ parent. hash_stable ( ctx, hasher) ;
2644
2645
( span. lo - def_span. lo ) . to_u32 ( ) . hash_stable ( ctx, hasher) ;
2645
2646
( span. hi - def_span. lo ) . to_u32 ( ) . hash_stable ( ctx, hasher) ;
2646
2647
return ;
@@ -2650,31 +2651,16 @@ where
2650
2651
// If this is not an empty or invalid span, we want to hash the last
2651
2652
// position that belongs to it, as opposed to hashing the first
2652
2653
// position past it.
2653
- let Some ( ( file, line_lo, col_lo, line_hi, col_hi) ) = ctx. span_data_to_lines_and_cols ( & span)
2654
- else {
2654
+ let Some ( ( file, line_lo, col_lo, ..) ) = ctx. span_data_to_lines_and_cols ( & span) else {
2655
2655
Hash :: hash ( & TAG_INVALID_SPAN , hasher) ;
2656
2656
return ;
2657
2657
} ;
2658
2658
2659
2659
Hash :: hash ( & TAG_VALID_SPAN , hasher) ;
2660
2660
Hash :: hash ( & file. stable_id , hasher) ;
2661
-
2662
- // Hash both the length and the end location (line/column) of a span. If we
2663
- // hash only the length, for example, then two otherwise equal spans with
2664
- // different end locations will have the same hash. This can cause a problem
2665
- // during incremental compilation wherein a previous result for a query that
2666
- // depends on the end location of a span will be incorrectly reused when the
2667
- // end location of the span it depends on has changed (see issue #74890). A
2668
- // similar analysis applies if some query depends specifically on the length
2669
- // of the span, but we only hash the end location. So hash both.
2670
-
2671
- let col_lo_trunc = ( col_lo. 0 as u64 ) & 0xFF ;
2672
- let line_lo_trunc = ( ( line_lo as u64 ) & 0xFF_FF_FF ) << 8 ;
2673
- let col_hi_trunc = ( col_hi. 0 as u64 ) & 0xFF << 32 ;
2674
- let line_hi_trunc = ( ( line_hi as u64 ) & 0xFF_FF_FF ) << 40 ;
2675
- let col_line = col_lo_trunc | line_lo_trunc | col_hi_trunc | line_hi_trunc;
2661
+ Hash :: hash ( & line_lo, hasher) ;
2662
+ Hash :: hash ( & col_lo, hasher) ;
2676
2663
let len = ( span. hi - span. lo ) . 0 ;
2677
- Hash :: hash ( & col_line, hasher) ;
2678
2664
Hash :: hash ( & len, hasher) ;
2679
2665
}
2680
2666
}
0 commit comments