@@ -501,17 +501,22 @@ macro_rules! define_feedable {
501501 $( #[ $attr] ) *
502502 #[ inline( always) ]
503503 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+
504508 let key = self . key( ) . into_query_param( ) ;
505509
506510 let tcx = self . tcx;
507511 let erased = queries:: $name:: provided_to_erased( tcx, value) ;
508- let value = restore:: <$V>( erased) ;
512+ let value = erase :: restore:: <$V>( erased) ;
509513 let cache = & tcx. query_system. caches. $name;
510514
515+ let dep_kind: dep_graph:: DepKind = dep_graph:: dep_kinds:: $name;
511516 let hasher: Option <fn ( & mut StableHashingContext <' _>, & _) -> _> = hash_result!( [ $( $modifiers) * ] ) ;
512517 match try_get_cached( tcx, cache, & key) {
513518 Some ( old) => {
514- let old = restore:: <$V>( old) ;
519+ let old = erase :: restore:: <$V>( old) ;
515520 if let Some ( hasher) = hasher {
516521 let ( value_hash, old_hash) : ( Fingerprint , Fingerprint ) = tcx. with_stable_hashing_context( |mut hcx|
517522 ( hasher( & mut hcx, & value) , hasher( & mut hcx, & old) )
@@ -521,28 +526,27 @@ macro_rules! define_feedable {
521526 // results is tainted by errors. In this case, delay a bug to
522527 // ensure compilation is doomed, and keep the `old` value.
523528 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 \
525530 old value: {old:?}\n new value: {value:?}",
526- stringify!( $name) ,
527531 ) ) ;
528532 }
529533 } else {
530534 // The query is `no_hash`, so we have no way to perform a sanity check.
531535 // If feeding the same value multiple times needs to be supported,
532536 // the query should not be marked `no_hash`.
533537 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:?}" ,
536540 )
537541 }
538542 }
539543 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) ;
541545 let dep_node_index = tcx. dep_graph. with_feed_task(
542546 dep_node,
543547 tcx,
544548 & value,
545- hash_result! ( [ $ ( $modifiers ) * ] ) ,
549+ hasher ,
546550 ) ;
547551 cache. complete( key, erased, dep_node_index) ;
548552 }
0 commit comments