File tree 1 file changed +20
-3
lines changed
compiler/rustc_query_system/src/query
1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -410,9 +410,26 @@ where
410
410
// as its feeding query had. So if the fed query is red, so is its feeder, which will
411
411
// get evaluated first, and re-feed the query.
412
412
if let Some ( ( cached_result, _) ) = cache. lookup ( & key) {
413
- panic ! (
414
- "fed query later has its value computed. The already cached value: {}" ,
415
- ( query. format_value( ) ) ( & cached_result)
413
+ let Some ( hasher) = query. hash_result ( ) else {
414
+ panic ! (
415
+ "fed query later has its value computed. The already cached value: {}" ,
416
+ ( query. format_value( ) ) ( & cached_result)
417
+ ) ;
418
+ } ;
419
+
420
+ let ( old_hash, new_hash) = qcx. dep_context ( ) . with_stable_hashing_context ( |mut hcx| {
421
+ ( hasher ( & mut hcx, & cached_result) , hasher ( & mut hcx, & result) )
422
+ } ) ;
423
+ let formatter = query. format_value ( ) ;
424
+ debug_assert_eq ! (
425
+ old_hash,
426
+ new_hash,
427
+ "Computed query value for {:?}({:?}) is inconsistent with fed value,\n \
428
+ computed={:#?}\n fed={:#?}",
429
+ query. dep_kind( ) ,
430
+ key,
431
+ formatter( & result) ,
432
+ formatter( & cached_result) ,
416
433
) ;
417
434
}
418
435
}
You can’t perform that action at this time.
0 commit comments