about summary refs log tree commit diff
path: root/compiler/rustc_query_impl/src/profiling_support.rs
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-04-19 14:43:21 +0200
committerGitHub <noreply@github.com>2022-04-19 14:43:21 +0200
commit9fad214593e87f151b8f09ff0cda9cd52372d037 (patch)
treec333bb0ef5940f836e2151ca3d87986d199e30d9 /compiler/rustc_query_impl/src/profiling_support.rs
parent036d200d1c7634f2a65e0dd28b094aa1220bbce0 (diff)
parent07ee0317638cf1f290a8dace1c7ccc8fea16a236 (diff)
Rollup merge of #96142 - cjgillot:no-crate-def-index, r=petrochenkov
Stop using CRATE_DEF_INDEX outside of metadata encoding.

`CRATE_DEF_ID` and `CrateNum::as_def_id` are almost always what we want.  We should not manipulate raw `DefIndex` outside of metadata encoding.
Diffstat (limited to 'compiler/rustc_query_impl/src/profiling_support.rs')
-rw-r--r--compiler/rustc_query_impl/src/profiling_support.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_query_impl/src/profiling_support.rs b/compiler/rustc_query_impl/src/profiling_support.rs
index acccf43f062..b20aa7b5346 100644
--- a/compiler/rustc_query_impl/src/profiling_support.rs
+++ b/compiler/rustc_query_impl/src/profiling_support.rs
@@ -1,7 +1,7 @@
 use measureme::{StringComponent, StringId};
 use rustc_data_structures::fx::FxHashMap;
 use rustc_data_structures::profiling::SelfProfiler;
-use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE};
+use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, LOCAL_CRATE};
 use rustc_hir::definitions::DefPathData;
 use rustc_middle::ty::{TyCtxt, WithOptConstParam};
 use rustc_query_system::query::QueryCache;
@@ -143,7 +143,7 @@ impl SpecIntoSelfProfilingString for CrateNum {
         &self,
         builder: &mut QueryKeyStringBuilder<'_, '_, '_>,
     ) -> StringId {
-        builder.def_id_to_string_id(DefId { krate: *self, index: CRATE_DEF_INDEX })
+        builder.def_id_to_string_id(self.as_def_id())
     }
 }