@@ -19,7 +19,6 @@ use rustc_data_structures::sync::Lock;
19
19
use rustc_errors:: { DiagnosticBuilder , ErrorGuaranteed , FatalError } ;
20
20
use rustc_session:: Session ;
21
21
use rustc_span:: { Span , DUMMY_SP } ;
22
- use std:: borrow:: Borrow ;
23
22
use std:: cell:: Cell ;
24
23
use std:: collections:: hash_map:: Entry ;
25
24
use std:: fmt:: Debug ;
@@ -364,25 +363,13 @@ where
364
363
let ( result, dep_node_index) =
365
364
execute_job :: < Q , Qcx > ( qcx, key. clone ( ) , dep_node, job. id ) ;
366
365
if Q :: FEEDABLE {
367
- // We may have put a value inside the cache from inside the execution.
368
- // Verify that it has the same hash as what we have now, to ensure consistency.
366
+ // We should not compute queries that also got a value via feeding.
367
+ // This can't happen, as query feeding adds the very dependencies to the fed query
368
+ // as its feeding query had. So if the fed query is red, so is its feeder, which will
369
+ // get evaluated first, and re-feed the query.
369
370
if let Some ( ( cached_result, _) ) = cache. lookup ( & key) {
370
- let hasher = Q :: HASH_RESULT . expect ( "feedable forbids no_hash" ) ;
371
-
372
- let old_hash = qcx. dep_context ( ) . with_stable_hashing_context ( |mut hcx| {
373
- hasher ( & mut hcx, cached_result. borrow ( ) )
374
- } ) ;
375
- let new_hash = qcx
376
- . dep_context ( )
377
- . with_stable_hashing_context ( |mut hcx| hasher ( & mut hcx, & result) ) ;
378
- debug_assert_eq ! (
379
- old_hash,
380
- new_hash,
381
- "Computed query value for {:?}({:?}) is inconsistent with fed value,\n computed={:#?}\n fed={:#?}" ,
382
- Q :: DEP_KIND ,
383
- key,
384
- result,
385
- cached_result,
371
+ panic ! (
372
+ "fed query later has its value computed. The already cached value: {cached_result:?}"
386
373
) ;
387
374
}
388
375
}
0 commit comments