Skip to content

Commit 16558bd

Browse files
committed
Rename tcx to qcx when it's a QueryContext
1 parent 91971f2 commit 16558bd

File tree

3 files changed

+94
-94
lines changed

3 files changed

+94
-94
lines changed

compiler/rustc_query_system/src/dep_graph/graph.rs

+19-19
Original file line numberDiff line numberDiff line change
@@ -573,10 +573,10 @@ impl<K: DepKind> DepGraph<K> {
573573
/// a node index can be found for that node.
574574
pub fn try_mark_green<Ctxt: QueryContext<DepKind = K>>(
575575
&self,
576-
tcx: Ctxt,
576+
qcx: Ctxt,
577577
dep_node: &DepNode<K>,
578578
) -> Option<(SerializedDepNodeIndex, DepNodeIndex)> {
579-
debug_assert!(!tcx.dep_context().is_eval_always(dep_node.kind));
579+
debug_assert!(!qcx.dep_context().is_eval_always(dep_node.kind));
580580

581581
// Return None if the dep graph is disabled
582582
let data = self.data.as_ref()?;
@@ -592,16 +592,16 @@ impl<K: DepKind> DepGraph<K> {
592592
// in the previous compilation session too, so we can try to
593593
// mark it as green by recursively marking all of its
594594
// dependencies green.
595-
self.try_mark_previous_green(tcx, data, prev_index, &dep_node)
595+
self.try_mark_previous_green(qcx, data, prev_index, &dep_node)
596596
.map(|dep_node_index| (prev_index, dep_node_index))
597597
}
598598
}
599599
}
600600

601-
#[instrument(skip(self, tcx, data, parent_dep_node_index), level = "debug")]
601+
#[instrument(skip(self, qcx, data, parent_dep_node_index), level = "debug")]
602602
fn try_mark_parent_green<Ctxt: QueryContext<DepKind = K>>(
603603
&self,
604-
tcx: Ctxt,
604+
qcx: Ctxt,
605605
data: &DepGraphData<K>,
606606
parent_dep_node_index: SerializedDepNodeIndex,
607607
dep_node: &DepNode<K>,
@@ -630,14 +630,14 @@ impl<K: DepKind> DepGraph<K> {
630630

631631
// We don't know the state of this dependency. If it isn't
632632
// an eval_always node, let's try to mark it green recursively.
633-
if !tcx.dep_context().is_eval_always(dep_dep_node.kind) {
633+
if !qcx.dep_context().is_eval_always(dep_dep_node.kind) {
634634
debug!(
635635
"state of dependency {:?} ({}) is unknown, trying to mark it green",
636636
dep_dep_node, dep_dep_node.hash,
637637
);
638638

639639
let node_index =
640-
self.try_mark_previous_green(tcx, data, parent_dep_node_index, dep_dep_node);
640+
self.try_mark_previous_green(qcx, data, parent_dep_node_index, dep_dep_node);
641641

642642
if node_index.is_some() {
643643
debug!("managed to MARK dependency {dep_dep_node:?} as green",);
@@ -647,7 +647,7 @@ impl<K: DepKind> DepGraph<K> {
647647

648648
// We failed to mark it green, so we try to force the query.
649649
debug!("trying to force dependency {dep_dep_node:?}");
650-
if !tcx.dep_context().try_force_from_dep_node(*dep_dep_node) {
650+
if !qcx.dep_context().try_force_from_dep_node(*dep_dep_node) {
651651
// The DepNode could not be forced.
652652
debug!("dependency {dep_dep_node:?} could not be forced");
653653
return None;
@@ -667,7 +667,7 @@ impl<K: DepKind> DepGraph<K> {
667667
None => {}
668668
}
669669

670-
if !tcx.dep_context().sess().has_errors_or_delayed_span_bugs() {
670+
if !qcx.dep_context().sess().has_errors_or_delayed_span_bugs() {
671671
panic!("try_mark_previous_green() - Forcing the DepNode should have set its color")
672672
}
673673

@@ -686,10 +686,10 @@ impl<K: DepKind> DepGraph<K> {
686686
}
687687

688688
/// Try to mark a dep-node which existed in the previous compilation session as green.
689-
#[instrument(skip(self, tcx, data, prev_dep_node_index), level = "debug")]
689+
#[instrument(skip(self, qcx, data, prev_dep_node_index), level = "debug")]
690690
fn try_mark_previous_green<Ctxt: QueryContext<DepKind = K>>(
691691
&self,
692-
tcx: Ctxt,
692+
qcx: Ctxt,
693693
data: &DepGraphData<K>,
694694
prev_dep_node_index: SerializedDepNodeIndex,
695695
dep_node: &DepNode<K>,
@@ -701,14 +701,14 @@ impl<K: DepKind> DepGraph<K> {
701701
}
702702

703703
// We never try to mark eval_always nodes as green
704-
debug_assert!(!tcx.dep_context().is_eval_always(dep_node.kind));
704+
debug_assert!(!qcx.dep_context().is_eval_always(dep_node.kind));
705705

706706
debug_assert_eq!(data.previous.index_to_node(prev_dep_node_index), *dep_node);
707707

708708
let prev_deps = data.previous.edge_targets_from(prev_dep_node_index);
709709

710710
for &dep_dep_node_index in prev_deps {
711-
self.try_mark_parent_green(tcx, data, dep_dep_node_index, dep_node)?
711+
self.try_mark_parent_green(qcx, data, dep_dep_node_index, dep_node)?
712712
}
713713

714714
// If we got here without hitting a `return` that means that all
@@ -720,7 +720,7 @@ impl<K: DepKind> DepGraph<K> {
720720
// We allocating an entry for the node in the current dependency graph and
721721
// adding all the appropriate edges imported from the previous graph
722722
let dep_node_index = data.current.promote_node_and_deps_to_current(
723-
tcx.dep_context().profiler(),
723+
qcx.dep_context().profiler(),
724724
&data.previous,
725725
prev_dep_node_index,
726726
);
@@ -729,7 +729,7 @@ impl<K: DepKind> DepGraph<K> {
729729

730730
// FIXME: Store the fact that a node has diagnostics in a bit in the dep graph somewhere
731731
// Maybe store a list on disk and encode this fact in the DepNodeState
732-
let side_effects = tcx.load_side_effects(prev_dep_node_index);
732+
let side_effects = qcx.load_side_effects(prev_dep_node_index);
733733

734734
#[cfg(not(parallel_compiler))]
735735
debug_assert!(
@@ -740,7 +740,7 @@ impl<K: DepKind> DepGraph<K> {
740740
);
741741

742742
if !side_effects.is_empty() {
743-
self.emit_side_effects(tcx, data, dep_node_index, side_effects);
743+
self.emit_side_effects(qcx, data, dep_node_index, side_effects);
744744
}
745745

746746
// ... and finally storing a "Green" entry in the color map.
@@ -757,7 +757,7 @@ impl<K: DepKind> DepGraph<K> {
757757
#[inline(never)]
758758
fn emit_side_effects<Ctxt: QueryContext<DepKind = K>>(
759759
&self,
760-
tcx: Ctxt,
760+
qcx: Ctxt,
761761
data: &DepGraphData<K>,
762762
dep_node_index: DepNodeIndex,
763763
side_effects: QuerySideEffects,
@@ -769,9 +769,9 @@ impl<K: DepKind> DepGraph<K> {
769769
// must process side effects
770770

771771
// Promote the previous diagnostics to the current session.
772-
tcx.store_side_effects(dep_node_index, side_effects.clone());
772+
qcx.store_side_effects(dep_node_index, side_effects.clone());
773773

774-
let handle = tcx.dep_context().sess().diagnostic();
774+
let handle = qcx.dep_context().sess().diagnostic();
775775

776776
for mut diagnostic in side_effects.diagnostics {
777777
handle.emit_diagnostic(&mut diagnostic);

compiler/rustc_query_system/src/query/job.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ pub(crate) fn report_cycle<'a>(
597597
}
598598

599599
pub fn print_query_stack<CTX: QueryContext>(
600-
tcx: CTX,
600+
qcx: CTX,
601601
mut current_query: Option<QueryJobId>,
602602
handler: &Handler,
603603
num_frames: Option<usize>,
@@ -606,7 +606,7 @@ pub fn print_query_stack<CTX: QueryContext>(
606606
// a panic hook, which means that the global `Handler` may be in a weird
607607
// state if it was responsible for triggering the panic.
608608
let mut i = 0;
609-
let query_map = tcx.try_collect_active_jobs();
609+
let query_map = qcx.try_collect_active_jobs();
610610

611611
while let Some(query) = current_query {
612612
if Some(i) == num_frames {

0 commit comments

Comments
 (0)