Skip to content

Commit d7c60a1

Browse files
committed
Auto merge of #50175 - michaelwoerister:backport-e31dae4, r=alexcrichton
[beta] Backport - Improve assertion in Query::force(). Follow up to #49695 (comment) r? @alexcrichton
2 parents 7d025f4 + eab568c commit d7c60a1

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
@@ -491,7 +491,16 @@ macro_rules! define_maps {
491491
span: Span,
492492
dep_node: DepNode)
493493
-> Result<($V, DepNodeIndex), CycleError<'a, $tcx>> {
494-
debug_assert!(!tcx.dep_graph.dep_node_exists(&dep_node));
494+
// If the following assertion triggers, it can have two reasons:
495+
// 1. Something is wrong with DepNode creation, either here or
496+
// in DepGraph::try_mark_green()
497+
// 2. Two distinct query keys get mapped to the same DepNode
498+
// (see for example #48923)
499+
assert!(!tcx.dep_graph.dep_node_exists(&dep_node),
500+
"Forcing query with already existing DepNode.\n\
501+
- query-key: {:?}\n\
502+
- dep-node: {:?}",
503+
key, dep_node);
495504

496505
profq_msg!(tcx, ProfileQueriesMsg::ProviderBegin);
497506
let res = tcx.cycle_check(span, Query::$name(key), || {

0 commit comments

Comments
 (0)