@@ -2641,6 +2641,7 @@ where
26412641 if def_span. contains ( span) {
26422642 // This span is enclosed in a definition: only hash the relative position.
26432643 Hash :: hash ( & TAG_RELATIVE_SPAN , hasher) ;
2644+ parent. hash_stable ( ctx, hasher) ;
26442645 ( span. lo - def_span. lo ) . to_u32 ( ) . hash_stable ( ctx, hasher) ;
26452646 ( span. hi - def_span. lo ) . to_u32 ( ) . hash_stable ( ctx, hasher) ;
26462647 return ;
@@ -2650,31 +2651,16 @@ where
26502651 // If this is not an empty or invalid span, we want to hash the last
26512652 // position that belongs to it, as opposed to hashing the first
26522653 // 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 {
26552655 Hash :: hash ( & TAG_INVALID_SPAN , hasher) ;
26562656 return ;
26572657 } ;
26582658
26592659 Hash :: hash ( & TAG_VALID_SPAN , hasher) ;
26602660 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) ;
26762663 let len = ( span. hi - span. lo ) . 0 ;
2677- Hash :: hash ( & col_line, hasher) ;
26782664 Hash :: hash ( & len, hasher) ;
26792665 }
26802666}
0 commit comments