diff options
Diffstat (limited to 'compiler/rustc_query_impl/src')
| -rw-r--r-- | compiler/rustc_query_impl/src/keys.rs | 188 | ||||
| -rw-r--r-- | compiler/rustc_query_impl/src/lib.rs | 7 | ||||
| -rw-r--r-- | compiler/rustc_query_impl/src/plumbing.rs | 82 | ||||
| -rw-r--r-- | compiler/rustc_query_impl/src/profiling_support.rs | 21 | ||||
| -rw-r--r-- | compiler/rustc_query_impl/src/stats.rs | 9 |
5 files changed, 151 insertions, 156 deletions
diff --git a/compiler/rustc_query_impl/src/keys.rs b/compiler/rustc_query_impl/src/keys.rs index 1fdb37398f9..b3cc7de4662 100644 --- a/compiler/rustc_query_impl/src/keys.rs +++ b/compiler/rustc_query_impl/src/keys.rs @@ -14,16 +14,28 @@ use rustc_span::{Span, DUMMY_SP}; pub trait Key { /// Given an instance of this key, what crate is it referring to? /// This is used to find the provider. - fn query_crate(&self) -> CrateNum; + fn query_crate_is_local(&self) -> bool; /// In the event that a cycle occurs, if no explicit span has been /// given for a query with key `self`, what span should we use? fn default_span(&self, tcx: TyCtxt<'_>) -> Span; } +impl Key for () { + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + true + } + + fn default_span(&self, _: TyCtxt<'_>) -> Span { + DUMMY_SP + } +} + impl<'tcx> Key for ty::InstanceDef<'tcx> { - fn query_crate(&self) -> CrateNum { - LOCAL_CRATE + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + true } fn default_span(&self, tcx: TyCtxt<'_>) -> Span { @@ -32,8 +44,9 @@ impl<'tcx> Key for ty::InstanceDef<'tcx> { } impl<'tcx> Key for ty::Instance<'tcx> { - fn query_crate(&self) -> CrateNum { - LOCAL_CRATE + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + true } fn default_span(&self, tcx: TyCtxt<'_>) -> Span { @@ -42,8 +55,9 @@ impl<'tcx> Key for ty::Instance<'tcx> { } impl<'tcx> Key for mir::interpret::GlobalId<'tcx> { - fn query_crate(&self) -> CrateNum { - self.instance.query_crate() + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + true } fn default_span(&self, tcx: TyCtxt<'_>) -> Span { @@ -52,8 +66,9 @@ impl<'tcx> Key for mir::interpret::GlobalId<'tcx> { } impl<'tcx> Key for mir::interpret::LitToConstInput<'tcx> { - fn query_crate(&self) -> CrateNum { - LOCAL_CRATE + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + true } fn default_span(&self, _tcx: TyCtxt<'_>) -> Span { @@ -62,8 +77,9 @@ impl<'tcx> Key for mir::interpret::LitToConstInput<'tcx> { } impl Key for CrateNum { - fn query_crate(&self) -> CrateNum { - *self + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + *self == LOCAL_CRATE } fn default_span(&self, _: TyCtxt<'_>) -> Span { DUMMY_SP @@ -71,8 +87,9 @@ impl Key for CrateNum { } impl Key for LocalDefId { - fn query_crate(&self) -> CrateNum { - self.to_def_id().query_crate() + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + true } fn default_span(&self, tcx: TyCtxt<'_>) -> Span { self.to_def_id().default_span(tcx) @@ -80,8 +97,9 @@ impl Key for LocalDefId { } impl Key for DefId { - fn query_crate(&self) -> CrateNum { - self.krate + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + self.krate == LOCAL_CRATE } fn default_span(&self, tcx: TyCtxt<'_>) -> Span { tcx.def_span(*self) @@ -89,8 +107,9 @@ impl Key for DefId { } impl Key for ty::WithOptConstParam<LocalDefId> { - fn query_crate(&self) -> CrateNum { - self.did.query_crate() + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + true } fn default_span(&self, tcx: TyCtxt<'_>) -> Span { self.did.default_span(tcx) @@ -98,8 +117,9 @@ impl Key for ty::WithOptConstParam<LocalDefId> { } impl Key for (DefId, DefId) { - fn query_crate(&self) -> CrateNum { - self.0.krate + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + self.0.krate == LOCAL_CRATE } fn default_span(&self, tcx: TyCtxt<'_>) -> Span { self.1.default_span(tcx) @@ -107,8 +127,9 @@ impl Key for (DefId, DefId) { } impl Key for (ty::Instance<'tcx>, LocalDefId) { - fn query_crate(&self) -> CrateNum { - self.0.query_crate() + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + true } fn default_span(&self, tcx: TyCtxt<'_>) -> Span { self.0.default_span(tcx) @@ -116,8 +137,9 @@ impl Key for (ty::Instance<'tcx>, LocalDefId) { } impl Key for (DefId, LocalDefId) { - fn query_crate(&self) -> CrateNum { - self.0.krate + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + self.0.krate == LOCAL_CRATE } fn default_span(&self, tcx: TyCtxt<'_>) -> Span { self.1.default_span(tcx) @@ -125,8 +147,9 @@ impl Key for (DefId, LocalDefId) { } impl Key for (LocalDefId, DefId) { - fn query_crate(&self) -> CrateNum { - LOCAL_CRATE + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + true } fn default_span(&self, tcx: TyCtxt<'_>) -> Span { self.0.default_span(tcx) @@ -134,8 +157,9 @@ impl Key for (LocalDefId, DefId) { } impl Key for (DefId, Option<Ident>) { - fn query_crate(&self) -> CrateNum { - self.0.krate + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + self.0.krate == LOCAL_CRATE } fn default_span(&self, tcx: TyCtxt<'_>) -> Span { tcx.def_span(self.0) @@ -143,8 +167,9 @@ impl Key for (DefId, Option<Ident>) { } impl Key for (DefId, LocalDefId, Ident) { - fn query_crate(&self) -> CrateNum { - self.0.krate + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + self.0.krate == LOCAL_CRATE } fn default_span(&self, tcx: TyCtxt<'_>) -> Span { self.1.default_span(tcx) @@ -152,8 +177,9 @@ impl Key for (DefId, LocalDefId, Ident) { } impl Key for (CrateNum, DefId) { - fn query_crate(&self) -> CrateNum { - self.0 + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + self.0 == LOCAL_CRATE } fn default_span(&self, tcx: TyCtxt<'_>) -> Span { self.1.default_span(tcx) @@ -161,8 +187,9 @@ impl Key for (CrateNum, DefId) { } impl Key for (DefId, SimplifiedType) { - fn query_crate(&self) -> CrateNum { - self.0.krate + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + self.0.krate == LOCAL_CRATE } fn default_span(&self, tcx: TyCtxt<'_>) -> Span { self.0.default_span(tcx) @@ -170,8 +197,9 @@ impl Key for (DefId, SimplifiedType) { } impl<'tcx> Key for SubstsRef<'tcx> { - fn query_crate(&self) -> CrateNum { - LOCAL_CRATE + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + true } fn default_span(&self, _: TyCtxt<'_>) -> Span { DUMMY_SP @@ -179,8 +207,9 @@ impl<'tcx> Key for SubstsRef<'tcx> { } impl<'tcx> Key for (DefId, SubstsRef<'tcx>) { - fn query_crate(&self) -> CrateNum { - self.0.krate + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + self.0.krate == LOCAL_CRATE } fn default_span(&self, tcx: TyCtxt<'_>) -> Span { self.0.default_span(tcx) @@ -193,8 +222,9 @@ impl<'tcx> Key (ty::WithOptConstParam<DefId>, SubstsRef<'tcx>), ) { - fn query_crate(&self) -> CrateNum { - (self.0).0.did.krate + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + (self.0).0.did.krate == LOCAL_CRATE } fn default_span(&self, tcx: TyCtxt<'_>) -> Span { (self.0).0.did.default_span(tcx) @@ -202,8 +232,9 @@ impl<'tcx> Key } impl<'tcx> Key for (LocalDefId, DefId, SubstsRef<'tcx>) { - fn query_crate(&self) -> CrateNum { - LOCAL_CRATE + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + true } fn default_span(&self, tcx: TyCtxt<'_>) -> Span { self.0.default_span(tcx) @@ -211,8 +242,9 @@ impl<'tcx> Key for (LocalDefId, DefId, SubstsRef<'tcx>) { } impl<'tcx> Key for (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>) { - fn query_crate(&self) -> CrateNum { - self.1.def_id().krate + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + self.1.def_id().krate == LOCAL_CRATE } fn default_span(&self, tcx: TyCtxt<'_>) -> Span { tcx.def_span(self.1.def_id()) @@ -220,8 +252,9 @@ impl<'tcx> Key for (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>) { } impl<'tcx> Key for (&'tcx ty::Const<'tcx>, mir::Field) { - fn query_crate(&self) -> CrateNum { - LOCAL_CRATE + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + true } fn default_span(&self, _: TyCtxt<'_>) -> Span { DUMMY_SP @@ -229,8 +262,9 @@ impl<'tcx> Key for (&'tcx ty::Const<'tcx>, mir::Field) { } impl<'tcx> Key for mir::interpret::ConstAlloc<'tcx> { - fn query_crate(&self) -> CrateNum { - LOCAL_CRATE + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + true } fn default_span(&self, _: TyCtxt<'_>) -> Span { DUMMY_SP @@ -238,8 +272,9 @@ impl<'tcx> Key for mir::interpret::ConstAlloc<'tcx> { } impl<'tcx> Key for ty::PolyTraitRef<'tcx> { - fn query_crate(&self) -> CrateNum { - self.def_id().krate + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + self.def_id().krate == LOCAL_CRATE } fn default_span(&self, tcx: TyCtxt<'_>) -> Span { tcx.def_span(self.def_id()) @@ -247,8 +282,9 @@ impl<'tcx> Key for ty::PolyTraitRef<'tcx> { } impl<'tcx> Key for GenericArg<'tcx> { - fn query_crate(&self) -> CrateNum { - LOCAL_CRATE + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + true } fn default_span(&self, _: TyCtxt<'_>) -> Span { DUMMY_SP @@ -256,8 +292,9 @@ impl<'tcx> Key for GenericArg<'tcx> { } impl<'tcx> Key for mir::ConstantKind<'tcx> { - fn query_crate(&self) -> CrateNum { - LOCAL_CRATE + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + true } fn default_span(&self, _: TyCtxt<'_>) -> Span { DUMMY_SP @@ -265,8 +302,9 @@ impl<'tcx> Key for mir::ConstantKind<'tcx> { } impl<'tcx> Key for &'tcx ty::Const<'tcx> { - fn query_crate(&self) -> CrateNum { - LOCAL_CRATE + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + true } fn default_span(&self, _: TyCtxt<'_>) -> Span { DUMMY_SP @@ -274,8 +312,9 @@ impl<'tcx> Key for &'tcx ty::Const<'tcx> { } impl<'tcx> Key for Ty<'tcx> { - fn query_crate(&self) -> CrateNum { - LOCAL_CRATE + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + true } fn default_span(&self, _: TyCtxt<'_>) -> Span { DUMMY_SP @@ -283,8 +322,9 @@ impl<'tcx> Key for Ty<'tcx> { } impl<'tcx> Key for &'tcx ty::List<ty::Predicate<'tcx>> { - fn query_crate(&self) -> CrateNum { - LOCAL_CRATE + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + true } fn default_span(&self, _: TyCtxt<'_>) -> Span { DUMMY_SP @@ -292,8 +332,9 @@ impl<'tcx> Key for &'tcx ty::List<ty::Predicate<'tcx>> { } impl<'tcx> Key for ty::ParamEnv<'tcx> { - fn query_crate(&self) -> CrateNum { - LOCAL_CRATE + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + true } fn default_span(&self, _: TyCtxt<'_>) -> Span { DUMMY_SP @@ -301,8 +342,9 @@ impl<'tcx> Key for ty::ParamEnv<'tcx> { } impl<'tcx, T: Key> Key for ty::ParamEnvAnd<'tcx, T> { - fn query_crate(&self) -> CrateNum { - self.value.query_crate() + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + self.value.query_crate_is_local() } fn default_span(&self, tcx: TyCtxt<'_>) -> Span { self.value.default_span(tcx) @@ -310,8 +352,9 @@ impl<'tcx, T: Key> Key for ty::ParamEnvAnd<'tcx, T> { } impl Key for Symbol { - fn query_crate(&self) -> CrateNum { - LOCAL_CRATE + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + true } fn default_span(&self, _tcx: TyCtxt<'_>) -> Span { DUMMY_SP @@ -321,8 +364,9 @@ impl Key for Symbol { /// Canonical query goals correspond to abstract trait operations that /// are not tied to any crate in particular. impl<'tcx, T> Key for Canonical<'tcx, T> { - fn query_crate(&self) -> CrateNum { - LOCAL_CRATE + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + true } fn default_span(&self, _tcx: TyCtxt<'_>) -> Span { @@ -331,8 +375,9 @@ impl<'tcx, T> Key for Canonical<'tcx, T> { } impl Key for (Symbol, u32, u32) { - fn query_crate(&self) -> CrateNum { - LOCAL_CRATE + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + true } fn default_span(&self, _tcx: TyCtxt<'_>) -> Span { @@ -341,8 +386,9 @@ impl Key for (Symbol, u32, u32) { } impl<'tcx> Key for (DefId, Ty<'tcx>, SubstsRef<'tcx>, ty::ParamEnv<'tcx>) { - fn query_crate(&self) -> CrateNum { - LOCAL_CRATE + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + true } fn default_span(&self, _tcx: TyCtxt<'_>) -> Span { diff --git a/compiler/rustc_query_impl/src/lib.rs b/compiler/rustc_query_impl/src/lib.rs index 00d886000fa..1d831affd1d 100644 --- a/compiler/rustc_query_impl/src/lib.rs +++ b/compiler/rustc_query_impl/src/lib.rs @@ -2,13 +2,9 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![feature(in_band_lifetimes)] -#![feature(exhaustive_patterns)] #![feature(nll)] #![feature(min_specialization)] -#![feature(crate_visibility_modifier)] -#![feature(once_cell)] #![feature(rustc_attrs)] -#![feature(never_type)] #![recursion_limit = "256"] #[macro_use] @@ -19,14 +15,13 @@ extern crate tracing; use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_errors::{DiagnosticBuilder, Handler}; -use rustc_hir::def_id::LOCAL_CRATE; use rustc_middle::dep_graph; use rustc_middle::ich::StableHashingContext; use rustc_middle::ty::query::{query_keys, query_storage, query_stored, query_values}; use rustc_middle::ty::query::{Providers, QueryEngine}; use rustc_middle::ty::{self, TyCtxt}; use rustc_serialize::opaque; -use rustc_span::{Span, DUMMY_SP}; +use rustc_span::Span; #[macro_use] mod plumbing; diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs index 4194b28dc7d..5907a587e16 100644 --- a/compiler/rustc_query_impl/src/plumbing.rs +++ b/compiler/rustc_query_impl/src/plumbing.rs @@ -3,7 +3,7 @@ //! manage the caches, and so forth. use super::queries; -use rustc_middle::dep_graph::{DepKind, DepNode, DepNodeExt, DepNodeIndex, SerializedDepNodeIndex}; +use rustc_middle::dep_graph::{DepKind, DepNode, DepNodeIndex, SerializedDepNodeIndex}; use rustc_middle::ty::query::on_disk_cache; use rustc_middle::ty::tls::{self, ImplicitCtxt}; use rustc_middle::ty::{self, TyCtxt}; @@ -14,7 +14,7 @@ use rustc_data_structures::sync::Lock; use rustc_data_structures::thin_vec::ThinVec; use rustc_errors::Diagnostic; use rustc_serialize::opaque; -use rustc_span::def_id::{DefId, LocalDefId}; +use rustc_span::def_id::LocalDefId; #[derive(Copy, Clone)] pub struct QueryCtxt<'tcx> { @@ -25,6 +25,7 @@ pub struct QueryCtxt<'tcx> { impl<'tcx> std::ops::Deref for QueryCtxt<'tcx> { type Target = TyCtxt<'tcx>; + #[inline] fn deref(&self) -> &Self::Target { &self.tcx } @@ -42,10 +43,6 @@ impl HasDepContext for QueryCtxt<'tcx> { } impl QueryContext for QueryCtxt<'tcx> { - fn def_path_str(&self, def_id: DefId) -> String { - self.tcx.def_path_str(def_id) - } - fn current_query_job(&self) -> Option<QueryJobId<Self::DepKind>> { tls::with_related_context(**self, |icx| icx.query) } @@ -60,39 +57,6 @@ impl QueryContext for QueryCtxt<'tcx> { } fn try_force_from_dep_node(&self, dep_node: &DepNode) -> bool { - // FIXME: This match is just a workaround for incremental bugs and should - // be removed. https://github.com/rust-lang/rust/issues/62649 is one such - // bug that must be fixed before removing this. - match dep_node.kind { - DepKind::hir_owner | DepKind::hir_owner_nodes => { - if let Some(def_id) = dep_node.extract_def_id(**self) { - let def_id = def_id.expect_local(); - let hir_id = self.tcx.hir().local_def_id_to_hir_id(def_id); - if def_id != hir_id.owner { - // This `DefPath` does not have a - // corresponding `DepNode` (e.g. a - // struct field), and the ` DefPath` - // collided with the `DefPath` of a - // proper item that existed in the - // previous compilation session. - // - // Since the given `DefPath` does not - // denote the item that previously - // existed, we just fail to mark green. - return false; - } - } else { - // If the node does not exist anymore, we - // just fail to mark green. - return false; - } - } - _ => { - // For other kinds of nodes it's OK to be - // forced. - } - } - debug!("try_force_from_dep_node({:?}) --- trying to force", dep_node); // We must avoid ever having to call `force_from_dep_node()` for a @@ -389,14 +353,14 @@ macro_rules! define_queries { } #[inline] - fn compute(tcx: QueryCtxt<'tcx>, key: Self::Key) -> Self::Value { - let is_local = key.query_crate() == LOCAL_CRATE; - let provider = if is_local { + fn compute_fn(tcx: QueryCtxt<'tcx>, key: &Self::Key) -> + fn(TyCtxt<'tcx>, Self::Key) -> Self::Value + { + if key.query_crate_is_local() { tcx.queries.local_providers.$name } else { tcx.queries.extern_providers.$name - }; - provider(*tcx, key) + } } fn hash_result( @@ -438,6 +402,11 @@ macro_rules! define_queries { try_load_from_on_disk_cache: |_, _| {}, }; + pub const CompileMonoItem: QueryStruct = QueryStruct { + force_from_dep_node: |_, _| false, + try_load_from_on_disk_cache: |_, _| {}, + }; + $(pub const $name: QueryStruct = { const is_anon: bool = is_anon!([$($modifiers)*]); @@ -452,20 +421,7 @@ macro_rules! define_queries { } fn force_from_dep_node(tcx: QueryCtxt<'_>, dep_node: &DepNode) -> bool { - if is_anon { - return false; - } - - if !can_reconstruct_query_key() { - return false; - } - - if let Some(key) = recover(*tcx, dep_node) { - force_query::<queries::$name<'_>, _>(tcx, key, DUMMY_SP, *dep_node); - return true; - } - - false + force_query::<queries::$name<'_>, _>(tcx, dep_node) } fn try_load_from_on_disk_cache(tcx: QueryCtxt<'_>, dep_node: &DepNode) { @@ -545,12 +501,10 @@ macro_rules! define_queries_struct { } impl QueryEngine<'tcx> for Queries<'tcx> { - unsafe fn deadlock(&'tcx self, _tcx: TyCtxt<'tcx>, _registry: &rustc_rayon_core::Registry) { - #[cfg(parallel_compiler)] - { - let tcx = QueryCtxt { tcx: _tcx, queries: self }; - rustc_query_system::query::deadlock(tcx, _registry) - } + #[cfg(parallel_compiler)] + unsafe fn deadlock(&'tcx self, tcx: TyCtxt<'tcx>, registry: &rustc_rayon_core::Registry) { + let tcx = QueryCtxt { tcx, queries: self }; + rustc_query_system::query::deadlock(tcx, registry) } fn encode_query_results( diff --git a/compiler/rustc_query_impl/src/profiling_support.rs b/compiler/rustc_query_impl/src/profiling_support.rs index 24485889731..95edc1e93a5 100644 --- a/compiler/rustc_query_impl/src/profiling_support.rs +++ b/compiler/rustc_query_impl/src/profiling_support.rs @@ -61,7 +61,7 @@ impl<'p, 'c, 'tcx> QueryKeyStringBuilder<'p, 'c, 'tcx> { match def_key.disambiguated_data.data { DefPathData::CrateRoot => { - crate_name = self.tcx.original_crate_name(def_id.krate).as_str(); + crate_name = self.tcx.crate_name(def_id.krate).as_str(); name = &*crate_name; dis = ""; end_index = 3; @@ -250,8 +250,8 @@ fn alloc_self_profile_query_strings_for_query_cache<'tcx, C>( // need to invoke queries itself, we cannot keep the query caches // locked while doing so. Instead we copy out the // `(query_key, dep_node_index)` pairs and release the lock again. - let query_keys_and_indices: Vec<_> = query_cache - .iter_results(|results| results.map(|(k, _, i)| (k.clone(), i)).collect()); + let mut query_keys_and_indices = Vec::new(); + query_cache.iter_results(&mut |k, _, i| query_keys_and_indices.push((k.clone(), i))); // Now actually allocate the strings. If allocating the strings // generates new entries in the query cache, we'll miss them but @@ -275,14 +275,15 @@ fn alloc_self_profile_query_strings_for_query_cache<'tcx, C>( let query_name = profiler.get_or_alloc_cached_string(query_name); let event_id = event_id_builder.from_label(query_name).to_string_id(); - query_cache.iter_results(|results| { - let query_invocation_ids: Vec<_> = results.map(|v| v.2.into()).collect(); - - profiler.bulk_map_query_invocation_id_to_single_string( - query_invocation_ids.into_iter(), - event_id, - ); + let mut query_invocation_ids = Vec::new(); + query_cache.iter_results(&mut |_, _, i| { + query_invocation_ids.push(i.into()); }); + + profiler.bulk_map_query_invocation_id_to_single_string( + query_invocation_ids.into_iter(), + event_id, + ); } }); } diff --git a/compiler/rustc_query_impl/src/stats.rs b/compiler/rustc_query_impl/src/stats.rs index 4d52483c3b8..e877034bd7b 100644 --- a/compiler/rustc_query_impl/src/stats.rs +++ b/compiler/rustc_query_impl/src/stats.rs @@ -50,13 +50,12 @@ where key_type: type_name::<C::Key>(), value_size: mem::size_of::<C::Value>(), value_type: type_name::<C::Value>(), - entry_count: map.iter_results(|results| results.count()), + entry_count: 0, local_def_id_keys: None, }; - map.iter_results(|results| { - for (key, _, _) in results { - key.key_stats(&mut stats) - } + map.iter_results(&mut |key, _, _| { + stats.entry_count += 1; + key.key_stats(&mut stats) }); stats } |
