Don't create two new closures for each query
- Parameterize DepKindStruct over `'tcx`
This allows passing in an invariant function pointer in `query_callback`,
rather than having to try and make it work for any lifetime.
- Add a new `execute_query` function to `QueryDescription` so we can call `tcx.$name` without needing to be in a macro context
This commit is contained in:
@@ -1089,7 +1089,7 @@ pub struct GlobalCtxt<'tcx> {
|
||||
|
||||
pub queries: &'tcx dyn query::QueryEngine<'tcx>,
|
||||
pub query_caches: query::QueryCaches<'tcx>,
|
||||
query_kinds: &'tcx [DepKindStruct],
|
||||
query_kinds: &'tcx [DepKindStruct<'tcx>],
|
||||
|
||||
// Internal caches for metadata decoding. No need to track deps on this.
|
||||
pub ty_rcache: Lock<FxHashMap<ty::CReaderCacheKey, Ty<'tcx>>>,
|
||||
@@ -1246,7 +1246,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
dep_graph: DepGraph,
|
||||
on_disk_cache: Option<&'tcx dyn OnDiskCache<'tcx>>,
|
||||
queries: &'tcx dyn query::QueryEngine<'tcx>,
|
||||
query_kinds: &'tcx [DepKindStruct],
|
||||
query_kinds: &'tcx [DepKindStruct<'tcx>],
|
||||
crate_name: &str,
|
||||
output_filenames: OutputFilenames,
|
||||
) -> GlobalCtxt<'tcx> {
|
||||
@@ -1296,7 +1296,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn query_kind(self, k: DepKind) -> &'tcx DepKindStruct {
|
||||
pub(crate) fn query_kind(self, k: DepKind) -> &'tcx DepKindStruct<'tcx> {
|
||||
&self.query_kinds[k as usize]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user