diff options
| author | bors <bors@rust-lang.org> | 2023-03-07 18:55:36 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-03-07 18:55:36 +0000 |
| commit | e3dfeeaa45f117281b19773d67f3f253de65cee1 (patch) | |
| tree | ac107049d15cef84f3fb23050b62447864229b1f /compiler/rustc_query_impl/src/on_disk_cache.rs | |
| parent | 1a521db67e2935e5a46c7b95b511ab9a43be5770 (diff) | |
| parent | d1c8430a34c01a5db8d5339b8a9cffa8a41002be (diff) | |
| download | rust-e3dfeeaa45f117281b19773d67f3f253de65cee1.tar.gz rust-e3dfeeaa45f117281b19773d67f3f253de65cee1.zip | |
Auto merge of #108167 - Zoxc:query-config-instance-slim, r=cjgillot
Make `rustc_query_system` take `QueryConfig` by instance. This allows for easy switching between virtual tables and specialized instances for queries. It also has the benefit of less turbofish. `QueryStorage` has also been merged with `QueryCache`. Split out from https://github.com/rust-lang/rust/pull/107937. r? `@cjgillot`
Diffstat (limited to 'compiler/rustc_query_impl/src/on_disk_cache.rs')
| -rw-r--r-- | compiler/rustc_query_impl/src/on_disk_cache.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/compiler/rustc_query_impl/src/on_disk_cache.rs b/compiler/rustc_query_impl/src/on_disk_cache.rs index 46e34462cf2..6522b1406be 100644 --- a/compiler/rustc_query_impl/src/on_disk_cache.rs +++ b/compiler/rustc_query_impl/src/on_disk_cache.rs @@ -13,7 +13,7 @@ use rustc_middle::mir::{self, interpret}; use rustc_middle::ty::codec::{RefDecodable, TyDecoder, TyEncoder}; use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_query_system::dep_graph::DepContext; -use rustc_query_system::query::{QueryCache, QueryContext, QuerySideEffects}; +use rustc_query_system::query::{QueryCache, QuerySideEffects}; use rustc_serialize::{ opaque::{FileEncodeResult, FileEncoder, IntEncodedWithFixedSize, MemDecoder}, Decodable, Decoder, Encodable, Encoder, @@ -1056,24 +1056,24 @@ impl<'a, 'tcx> Encodable<CacheEncoder<'a, 'tcx>> for [u8] { } } -pub fn encode_query_results<'a, 'tcx, CTX, Q>( - tcx: CTX, +pub fn encode_query_results<'a, 'tcx, Q>( + query: Q, + qcx: QueryCtxt<'tcx>, encoder: &mut CacheEncoder<'a, 'tcx>, query_result_index: &mut EncodedDepNodeIndex, ) where - CTX: QueryContext + 'tcx, - Q: super::QueryConfig<CTX>, + Q: super::QueryConfig<QueryCtxt<'tcx>>, Q::Value: Encodable<CacheEncoder<'a, 'tcx>>, { - let _timer = tcx - .dep_context() + let _timer = qcx + .tcx .profiler() - .verbose_generic_activity_with_arg("encode_query_results_for", std::any::type_name::<Q>()); + .verbose_generic_activity_with_arg("encode_query_results_for", query.name()); - assert!(Q::query_state(tcx).all_inactive()); - let cache = Q::query_cache(tcx); + assert!(query.query_state(qcx).all_inactive()); + let cache = query.query_cache(qcx); cache.iter(&mut |key, value, dep_node| { - if Q::cache_on_disk(*tcx.dep_context(), &key) { + if query.cache_on_disk(qcx.tcx, &key) { let dep_node = SerializedDepNodeIndex::new(dep_node.index()); // Record position of the cache entry. |
