Skip to content

Commit 16d1b78

Browse files
committed
Prepare define_feedable! for code extraction
1 parent 56a6fb5 commit 16d1b78

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

compiler/rustc_middle/src/query/plumbing.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,7 @@ macro_rules! define_feedable {
570570
let value = restore::<$V>(erased);
571571
let cache = &tcx.query_system.caches.$name;
572572

573+
let dep_kind: dep_graph::DepKind = dep_graph::dep_kinds::$name;
573574
let hasher: Option<fn(&mut StableHashingContext<'_>, &_) -> _> = hash_result!([$($modifiers)*]);
574575
match try_get_cached(tcx, cache, &key) {
575576
Some(old) => {
@@ -583,28 +584,27 @@ macro_rules! define_feedable {
583584
// results is tainted by errors. In this case, delay a bug to
584585
// ensure compilation is doomed, and keep the `old` value.
585586
tcx.dcx().delayed_bug(format!(
586-
"Trying to feed an already recorded value for query {} key={key:?}:\n\
587+
"Trying to feed an already recorded value for query {dep_kind:?} key={key:?}:\n\
587588
old value: {old:?}\nnew value: {value:?}",
588-
stringify!($name),
589589
));
590590
}
591591
} else {
592592
// The query is `no_hash`, so we have no way to perform a sanity check.
593593
// If feeding the same value multiple times needs to be supported,
594594
// the query should not be marked `no_hash`.
595595
bug!(
596-
"Trying to feed an already recorded value for query {} key={key:?}:\nold value: {old:?}\nnew value: {value:?}",
597-
stringify!($name),
596+
"Trying to feed an already recorded value for query {dep_kind:?} key={key:?}:\n\
597+
old value: {old:?}\nnew value: {value:?}",
598598
)
599599
}
600600
}
601601
None => {
602-
let dep_node = dep_graph::DepNode::construct(tcx, dep_graph::dep_kinds::$name, &key);
602+
let dep_node = dep_graph::DepNode::construct(tcx, dep_kind, &key);
603603
let dep_node_index = tcx.dep_graph.with_feed_task(
604604
dep_node,
605605
tcx,
606606
&value,
607-
hash_result!([$($modifiers)*]),
607+
hasher,
608608
);
609609
cache.complete(key, erased, dep_node_index);
610610
}

0 commit comments

Comments
 (0)