Skip to content

Commit 45d6dec

Browse files
committed
Remove try_mark_green_and_read.
1 parent c3bf396 commit 45d6dec

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

compiler/rustc_query_system/src/dep_graph/graph.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -499,22 +499,11 @@ impl<K: DepKind> DepGraph<K> {
499499
None
500500
}
501501

502-
/// Try to read a node index for the node dep_node.
502+
/// Try to mark a node index for the node dep_node.
503+
///
503504
/// A node will have an index, when it's already been marked green, or when we can mark it
504505
/// green. This function will mark the current task as a reader of the specified node, when
505506
/// a node index can be found for that node.
506-
pub fn try_mark_green_and_read<Ctxt: QueryContext<DepKind = K>>(
507-
&self,
508-
tcx: Ctxt,
509-
dep_node: &DepNode<K>,
510-
) -> Option<(SerializedDepNodeIndex, DepNodeIndex)> {
511-
self.try_mark_green(tcx, dep_node).map(|(prev_index, dep_node_index)| {
512-
debug_assert!(self.is_green(&dep_node));
513-
self.read_index(dep_node_index);
514-
(prev_index, dep_node_index)
515-
})
516-
}
517-
518507
pub fn try_mark_green<Ctxt: QueryContext<DepKind = K>>(
519508
&self,
520509
tcx: Ctxt,

compiler/rustc_query_system/src/query/plumbing.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,8 @@ where
523523
// We must ensure that this is handled correctly.
524524

525525
let (prev_dep_node_index, dep_node_index) =
526-
tcx.dep_context().dep_graph().try_mark_green_and_read(tcx, &dep_node)?;
526+
tcx.dep_context().dep_graph().try_mark_green(tcx, &dep_node)?;
527+
tcx.dep_context().dep_graph().read_index(dep_node_index);
527528

528529
debug_assert!(tcx.dep_context().dep_graph().is_green(dep_node));
529530

@@ -725,9 +726,10 @@ where
725726

726727
let dep_node = query.to_dep_node(*tcx.dep_context(), key);
727728

728-
match tcx.dep_context().dep_graph().try_mark_green_and_read(tcx, &dep_node) {
729+
let dep_graph = tcx.dep_context().dep_graph();
730+
match dep_graph.try_mark_green(tcx, &dep_node) {
729731
None => {
730-
// A None return from `try_mark_green_and_read` means that this is either
732+
// A None return from `try_mark_green` means that this is either
731733
// a new dep node or that the dep node has already been marked red.
732734
// Either way, we can't call `dep_graph.read()` as we don't have the
733735
// DepNodeIndex. We must invoke the query itself. The performance cost
@@ -736,6 +738,7 @@ where
736738
true
737739
}
738740
Some((_, dep_node_index)) => {
741+
dep_graph.read_index(dep_node_index);
739742
tcx.dep_context().profiler().query_cache_hit(dep_node_index.into());
740743
false
741744
}

0 commit comments

Comments
 (0)