Skip to content

Commit 1ac21e4

Browse files
committed
Use QueryCtxt in DepKindStruct.
1 parent b27266f commit 1ac21e4

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

compiler/rustc_middle/src/dep_graph/dep_node.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ pub struct DepKindStruct {
135135
/// then `force_from_dep_node()` should not fail for it. Otherwise, you can just
136136
/// add it to the "We don't have enough information to reconstruct..." group in
137137
/// the match below.
138-
pub(crate) force_from_dep_node: fn(tcx: TyCtxt<'_>, dep_node: &DepNode) -> bool,
138+
pub(crate) force_from_dep_node: fn(tcx: QueryCtxt<'_>, dep_node: &DepNode) -> bool,
139139

140140
/// Invoke a query to put the on-disk cached value in memory.
141141
pub(crate) try_load_from_on_disk_cache: fn(QueryCtxt<'_>, &DepNode),
@@ -251,7 +251,7 @@ pub mod dep_kind {
251251
<query_keys::$variant<'_> as DepNodeParams<TyCtxt<'_>>>::recover(tcx, dep_node)
252252
}
253253

254-
fn force_from_dep_node(tcx: TyCtxt<'_>, dep_node: &DepNode) -> bool {
254+
fn force_from_dep_node(tcx: QueryCtxt<'_>, dep_node: &DepNode) -> bool {
255255
if is_anon {
256256
return false;
257257
}
@@ -260,13 +260,8 @@ pub mod dep_kind {
260260
return false;
261261
}
262262

263-
if let Some(key) = recover(tcx, dep_node) {
264-
force_query::<queries::$variant<'_>, _>(
265-
QueryCtxt { tcx, queries: tcx.queries },
266-
key,
267-
DUMMY_SP,
268-
*dep_node
269-
);
263+
if let Some(key) = recover(*tcx, dep_node) {
264+
force_query::<queries::$variant<'_>, _>(tcx, key, DUMMY_SP, *dep_node);
270265
return true;
271266
}
272267

compiler/rustc_middle/src/ty/query/plumbing.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl QueryContext for QueryCtxt<'tcx> {
6868
self.queries.try_collect_active_jobs()
6969
}
7070

71-
fn try_load_from_on_disk_cache(&self, dep_node: &dep_graph::DepNode) {
71+
fn try_load_from_on_disk_cache(&self, dep_node: &DepNode) {
7272
(dep_node.kind.try_load_from_on_disk_cache)(*self, dep_node)
7373
}
7474

@@ -126,7 +126,7 @@ impl QueryContext for QueryCtxt<'tcx> {
126126
"calling force_from_dep_node() on DepKind::codegen_unit"
127127
);
128128

129-
(dep_node.kind.force_from_dep_node)(**self, dep_node)
129+
(dep_node.kind.force_from_dep_node)(*self, dep_node)
130130
}
131131

132132
fn has_errors_or_delayed_span_bugs(&self) -> bool {

0 commit comments

Comments
 (0)