Skip to content

Commit 84f7991

Browse files
authored
Rollup merge of #75462 - Mark-Simulacrum:clean-queries, r=petrochenkov
Remove unused tcx parameter We shouldn't need access to a query context when storing already computed values.
2 parents c76259a + bff104d commit 84f7991

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

src/librustc_query_system/query/caches.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ pub trait QueryCache: QueryStorage {
4343
OnHit: FnOnce(&Self::Stored, DepNodeIndex) -> R,
4444
OnMiss: FnOnce(Self::Key, QueryLookup<'_, CTX, Self::Key, Self::Sharded>) -> R;
4545

46-
fn complete<CTX: QueryContext>(
46+
fn complete(
4747
&self,
48-
tcx: CTX,
4948
lock_sharded_storage: &mut Self::Sharded,
5049
key: Self::Key,
5150
value: Self::Value,
@@ -112,9 +111,8 @@ impl<K: Eq + Hash, V: Clone> QueryCache for DefaultCache<K, V> {
112111
}
113112

114113
#[inline]
115-
fn complete<CTX: QueryContext>(
114+
fn complete(
116115
&self,
117-
_: CTX,
118116
lock_sharded_storage: &mut Self::Sharded,
119117
key: K,
120118
value: V,
@@ -195,9 +193,8 @@ impl<'tcx, K: Eq + Hash, V: 'tcx> QueryCache for ArenaCache<'tcx, K, V> {
195193
}
196194

197195
#[inline]
198-
fn complete<CTX: QueryContext>(
196+
fn complete(
199197
&self,
200-
_: CTX,
201198
lock_sharded_storage: &mut Self::Sharded,
202199
key: K,
203200
value: V,

src/librustc_query_system/query/plumbing.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ where
264264
/// Completes the query by updating the query cache with the `result`,
265265
/// signals the waiter and forgets the JobOwner, so it won't poison the query
266266
#[inline(always)]
267-
fn complete(self, tcx: CTX, result: C::Value, dep_node_index: DepNodeIndex) -> C::Stored {
267+
fn complete(self, result: C::Value, dep_node_index: DepNodeIndex) -> C::Stored {
268268
// We can move out of `self` here because we `mem::forget` it below
269269
let key = unsafe { ptr::read(&self.key) };
270270
let state = self.state;
@@ -278,7 +278,7 @@ where
278278
QueryResult::Started(job) => job,
279279
QueryResult::Poisoned => panic!(),
280280
};
281-
let result = state.cache.complete(tcx, &mut lock.cache, key, result, dep_node_index);
281+
let result = state.cache.complete(&mut lock.cache, key, result, dep_node_index);
282282
(job, result)
283283
};
284284

@@ -432,7 +432,7 @@ where
432432
tcx.store_diagnostics_for_anon_node(dep_node_index, diagnostics);
433433
}
434434

435-
return job.complete(tcx, result, dep_node_index);
435+
return job.complete(result, dep_node_index);
436436
}
437437

438438
let dep_node = query.to_dep_node(tcx, &key);
@@ -458,7 +458,7 @@ where
458458
})
459459
});
460460
if let Some((result, dep_node_index)) = loaded {
461-
return job.complete(tcx, result, dep_node_index);
461+
return job.complete(result, dep_node_index);
462462
}
463463
}
464464

@@ -609,7 +609,7 @@ where
609609
}
610610
}
611611

612-
let result = job.complete(tcx, result, dep_node_index);
612+
let result = job.complete(result, dep_node_index);
613613

614614
(result, dep_node_index)
615615
}

0 commit comments

Comments
 (0)