mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 00:34:06 +00:00
Make encode_query_results more generic.
This commit is contained in:
parent
24dbb61e58
commit
23f9d10ea7
@ -3,7 +3,6 @@ use crate::mir::interpret::{AllocDecodingSession, AllocDecodingState};
|
|||||||
use crate::mir::{self, interpret};
|
use crate::mir::{self, interpret};
|
||||||
use crate::ty::codec::{RefDecodable, TyDecoder, TyEncoder};
|
use crate::ty::codec::{RefDecodable, TyDecoder, TyEncoder};
|
||||||
use crate::ty::context::TyCtxt;
|
use crate::ty::context::TyCtxt;
|
||||||
use crate::ty::query::QueryCtxt;
|
|
||||||
use crate::ty::{self, Ty};
|
use crate::ty::{self, Ty};
|
||||||
use rustc_data_structures::fingerprint::{Fingerprint, FingerprintDecoder, FingerprintEncoder};
|
use rustc_data_structures::fingerprint::{Fingerprint, FingerprintDecoder, FingerprintEncoder};
|
||||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet};
|
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet};
|
||||||
@ -15,6 +14,8 @@ use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, LOCAL_CRATE};
|
|||||||
use rustc_hir::definitions::DefPathHash;
|
use rustc_hir::definitions::DefPathHash;
|
||||||
use rustc_hir::definitions::Definitions;
|
use rustc_hir::definitions::Definitions;
|
||||||
use rustc_index::vec::{Idx, IndexVec};
|
use rustc_index::vec::{Idx, IndexVec};
|
||||||
|
use rustc_query_system::dep_graph::DepContext;
|
||||||
|
use rustc_query_system::query::QueryContext;
|
||||||
use rustc_serialize::{
|
use rustc_serialize::{
|
||||||
opaque::{self, FileEncodeResult, FileEncoder},
|
opaque::{self, FileEncodeResult, FileEncoder},
|
||||||
Decodable, Decoder, Encodable, Encoder,
|
Decodable, Decoder, Encodable, Encoder,
|
||||||
@ -1215,18 +1216,19 @@ impl<'a> Decodable<opaque::Decoder<'a>> for IntEncodedWithFixedSize {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn encode_query_results<'a, 'tcx, Q>(
|
pub fn encode_query_results<'a, 'tcx, CTX, Q>(
|
||||||
tcx: QueryCtxt<'tcx>,
|
tcx: CTX,
|
||||||
encoder: &mut CacheEncoder<'a, 'tcx, FileEncoder>,
|
encoder: &mut CacheEncoder<'a, 'tcx, FileEncoder>,
|
||||||
query_result_index: &mut EncodedQueryResultIndex,
|
query_result_index: &mut EncodedQueryResultIndex,
|
||||||
) -> FileEncodeResult
|
) -> FileEncodeResult
|
||||||
where
|
where
|
||||||
Q: super::QueryDescription<QueryCtxt<'tcx>> + super::QueryAccessors<QueryCtxt<'tcx>>,
|
CTX: QueryContext + 'tcx,
|
||||||
|
Q: super::QueryDescription<CTX> + super::QueryAccessors<CTX>,
|
||||||
Q::Value: Encodable<CacheEncoder<'a, 'tcx, FileEncoder>>,
|
Q::Value: Encodable<CacheEncoder<'a, 'tcx, FileEncoder>>,
|
||||||
{
|
{
|
||||||
let _timer = tcx
|
let _timer = tcx
|
||||||
.sess
|
.dep_context()
|
||||||
.prof
|
.profiler()
|
||||||
.extra_verbose_generic_activity("encode_query_results_for", std::any::type_name::<Q>());
|
.extra_verbose_generic_activity("encode_query_results_for", std::any::type_name::<Q>());
|
||||||
|
|
||||||
assert!(Q::query_state(tcx).all_inactive());
|
assert!(Q::query_state(tcx).all_inactive());
|
||||||
|
@ -251,7 +251,7 @@ impl<'tcx> QueryCtxt<'tcx> {
|
|||||||
macro_rules! encode_queries {
|
macro_rules! encode_queries {
|
||||||
($($query:ident,)*) => {
|
($($query:ident,)*) => {
|
||||||
$(
|
$(
|
||||||
on_disk_cache::encode_query_results::<ty::query::queries::$query<'_>>(
|
on_disk_cache::encode_query_results::<_, ty::query::queries::$query<'_>>(
|
||||||
self,
|
self,
|
||||||
encoder,
|
encoder,
|
||||||
query_result_index
|
query_result_index
|
||||||
|
Loading…
Reference in New Issue
Block a user