@@ -501,17 +501,22 @@ macro_rules! define_feedable {
501
501
$( #[ $attr] ) *
502
502
#[ inline( always) ]
503
503
pub fn $name( self , value: queries:: $name:: ProvidedValue <' tcx>) {
504
+ #![ allow( unused_imports) ] // Removed later in this PR.
505
+ use rustc_data_structures:: fingerprint:: Fingerprint ;
506
+ use rustc_query_system:: query:: { QueryCache , try_get_cached} ;
507
+
504
508
let key = self . key( ) . into_query_param( ) ;
505
509
506
510
let tcx = self . tcx;
507
511
let erased = queries:: $name:: provided_to_erased( tcx, value) ;
508
- let value = restore:: <$V>( erased) ;
512
+ let value = erase :: restore:: <$V>( erased) ;
509
513
let cache = & tcx. query_system. caches. $name;
510
514
515
+ let dep_kind: dep_graph:: DepKind = dep_graph:: dep_kinds:: $name;
511
516
let hasher: Option <fn ( & mut StableHashingContext <' _>, & _) -> _> = hash_result!( [ $( $modifiers) * ] ) ;
512
517
match try_get_cached( tcx, cache, & key) {
513
518
Some ( old) => {
514
- let old = restore:: <$V>( old) ;
519
+ let old = erase :: restore:: <$V>( old) ;
515
520
if let Some ( hasher) = hasher {
516
521
let ( value_hash, old_hash) : ( Fingerprint , Fingerprint ) = tcx. with_stable_hashing_context( |mut hcx|
517
522
( hasher( & mut hcx, & value) , hasher( & mut hcx, & old) )
@@ -521,28 +526,27 @@ macro_rules! define_feedable {
521
526
// results is tainted by errors. In this case, delay a bug to
522
527
// ensure compilation is doomed, and keep the `old` value.
523
528
tcx. dcx( ) . delayed_bug( format!(
524
- "Trying to feed an already recorded value for query {} key={key:?}:\n \
529
+ "Trying to feed an already recorded value for query {dep_kind:? } key={key:?}:\n \
525
530
old value: {old:?}\n new value: {value:?}",
526
- stringify!( $name) ,
527
531
) ) ;
528
532
}
529
533
} else {
530
534
// The query is `no_hash`, so we have no way to perform a sanity check.
531
535
// If feeding the same value multiple times needs to be supported,
532
536
// the query should not be marked `no_hash`.
533
537
bug!(
534
- "Trying to feed an already recorded value for query {} key={key:?}:\n old value: {old:?} \n new value: {value:?}" ,
535
- stringify! ( $name ) ,
538
+ "Trying to feed an already recorded value for query {dep_kind:? } key={key:?}:\n \
539
+ old value: {old:?} \n new value: {value:?}" ,
536
540
)
537
541
}
538
542
}
539
543
None => {
540
- let dep_node = dep_graph:: DepNode :: construct( tcx, dep_graph :: dep_kinds :: $name , & key) ;
544
+ let dep_node = dep_graph:: DepNode :: construct( tcx, dep_kind , & key) ;
541
545
let dep_node_index = tcx. dep_graph. with_feed_task(
542
546
dep_node,
543
547
tcx,
544
548
& value,
545
- hash_result! ( [ $ ( $modifiers ) * ] ) ,
549
+ hasher ,
546
550
) ;
547
551
cache. complete( key, erased, dep_node_index) ;
548
552
}
0 commit comments