diff options
Diffstat (limited to 'compiler/rustc_query_impl/src')
| -rw-r--r-- | compiler/rustc_query_impl/src/keys.rs | 12 | ||||
| -rw-r--r-- | compiler/rustc_query_impl/src/stats.rs | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/compiler/rustc_query_impl/src/keys.rs b/compiler/rustc_query_impl/src/keys.rs index b3cc7de4662..1993e0a602f 100644 --- a/compiler/rustc_query_impl/src/keys.rs +++ b/compiler/rustc_query_impl/src/keys.rs @@ -1,6 +1,7 @@ //! Defines the set of legal keys that can be used in queries. use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LOCAL_CRATE}; +use rustc_hir::HirId; use rustc_middle::infer::canonical::Canonical; use rustc_middle::mir; use rustc_middle::ty::fast_reject::SimplifiedType; @@ -395,3 +396,14 @@ impl<'tcx> Key for (DefId, Ty<'tcx>, SubstsRef<'tcx>, ty::ParamEnv<'tcx>) { DUMMY_SP } } + +impl<'tcx> Key for (ty::Predicate<'tcx>, HirId) { + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + true + } + + fn default_span(&self, _tcx: TyCtxt<'_>) -> Span { + DUMMY_SP + } +} diff --git a/compiler/rustc_query_impl/src/stats.rs b/compiler/rustc_query_impl/src/stats.rs index e877034bd7b..fa48df3ed45 100644 --- a/compiler/rustc_query_impl/src/stats.rs +++ b/compiler/rustc_query_impl/src/stats.rs @@ -108,7 +108,7 @@ pub fn print_stats(tcx: TyCtxt<'_>) { queries.iter().filter(|q| q.local_def_id_keys.is_some()).collect(); def_id_density.sort_by_key(|q| q.local_def_id_keys.unwrap()); eprintln!("\nLocal DefId density:"); - let total = tcx.hir().definitions().def_index_count() as f64; + let total = tcx.resolutions(()).definitions.def_index_count() as f64; for q in def_id_density.iter().rev() { let local = q.local_def_id_keys.unwrap(); eprintln!(" {} - {} = ({}%)", q.name, local, (local as f64 * 100.0) / total); |
