Skip to content

Commit e31dae4

Browse files
Improve assertion in Query::force().
1 parent abfc8c2 commit e31dae4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/librustc/ty/maps/plumbing.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,16 @@ macro_rules! define_maps {
636636
map: LockGuard<'_, QueryMap<$tcx, Self>>,
637637
dep_node: DepNode)
638638
-> Result<($V, DepNodeIndex), CycleError<$tcx>> {
639-
debug_assert!(!tcx.dep_graph.dep_node_exists(&dep_node));
639+
// If the following assertion triggers, it can have two reasons:
640+
// 1. Something is wrong with DepNode creation, either here or
641+
// in DepGraph::try_mark_green()
642+
// 2. Two distinct query keys get mapped to the same DepNode
643+
// (see for example #48923)
644+
assert!(!tcx.dep_graph.dep_node_exists(&dep_node),
645+
"Forcing query with already existing DepNode.\n\
646+
- query-key: {:?}\n\
647+
- dep-node: {:?}",
648+
key, dep_node);
640649

641650
profq_msg!(tcx, ProfileQueriesMsg::ProviderBegin);
642651
let res = Self::start_job(tcx,

0 commit comments

Comments
 (0)