Skip to content

Commit d08f97d

Browse files
committed
Remove QueryVTable::construct_dep_node.
It's just a wrapper for `DepNode::construct` and it only has three uses. Better to just have one way of doing things.
1 parent d863850 commit d08f97d

2 files changed

Lines changed: 6 additions & 10 deletions

File tree

compiler/rustc_middle/src/query/plumbing.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_macros::HashStable;
1111
use rustc_span::{ErrorGuaranteed, Span};
1212
pub use sealed::IntoQueryParam;
1313

14-
use crate::dep_graph::{DepKind, DepNode, DepNodeIndex, SerializedDepNodeIndex};
14+
use crate::dep_graph::{DepKind, DepNodeIndex, SerializedDepNodeIndex};
1515
use crate::ich::StableHashingContext;
1616
use crate::queries::{ExternProviders, Providers, QueryArenas, QueryVTables};
1717
use crate::query::on_disk_cache::OnDiskCache;
@@ -180,12 +180,6 @@ impl<'tcx, C: QueryCache> fmt::Debug for QueryVTable<'tcx, C> {
180180
}
181181
}
182182

183-
impl<'tcx, C: QueryCache> QueryVTable<'tcx, C> {
184-
pub fn construct_dep_node(&self, tcx: TyCtxt<'tcx>, key: &C::Key) -> DepNode {
185-
DepNode::construct(tcx, self.dep_kind, key)
186-
}
187-
}
188-
189183
pub struct QuerySystem<'tcx> {
190184
pub arenas: WorkerLocal<QueryArenas<'tcx>>,
191185
pub query_vtables: QueryVTables<'tcx>,

compiler/rustc_query_impl/src/execution.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,8 @@ fn execute_job_incr<'tcx, C: QueryCache>(
453453

454454
if !query.anon && !query.eval_always {
455455
// `to_dep_node` is expensive for some `DepKind`s.
456-
let dep_node = dep_node_opt.get_or_insert_with(|| query.construct_dep_node(tcx, &key));
456+
let dep_node =
457+
dep_node_opt.get_or_insert_with(|| DepNode::construct(tcx, query.dep_kind, &key));
457458

458459
// The diagnostics for this query will be promoted to the current session during
459460
// `try_mark_green()`, so we can ignore them here.
@@ -485,7 +486,8 @@ fn execute_job_incr<'tcx, C: QueryCache>(
485486
}
486487

487488
// `to_dep_node` is expensive for some `DepKind`s.
488-
let dep_node = dep_node_opt.unwrap_or_else(|| query.construct_dep_node(tcx, &key));
489+
let dep_node =
490+
dep_node_opt.unwrap_or_else(|| DepNode::construct(tcx, query.dep_kind, &key));
489491

490492
// Call the query provider.
491493
dep_graph_data.with_task(
@@ -629,7 +631,7 @@ fn check_if_ensure_can_skip_execution<'tcx, C: QueryCache>(
629631
// Ensuring an anonymous query makes no sense
630632
assert!(!query.anon);
631633

632-
let dep_node = query.construct_dep_node(tcx, key);
634+
let dep_node = DepNode::construct(tcx, query.dep_kind, key);
633635

634636
let dep_graph = &tcx.dep_graph;
635637
let serialized_dep_node_index = match dep_graph.try_mark_green(tcx, &dep_node) {

0 commit comments

Comments
 (0)