@@ -9,7 +9,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
99use rustc_data_structures:: svh:: Svh ;
1010use rustc_hir:: def:: { DefKind , Res } ;
1111use rustc_hir:: def_id:: { CrateNum , DefId , LocalDefId , CRATE_DEF_INDEX , LOCAL_CRATE } ;
12- use rustc_hir:: definitions:: { DefKey , DefPath , Definitions } ;
12+ use rustc_hir:: definitions:: { DefKey , DefPath , DefPathHash } ;
1313use rustc_hir:: intravisit;
1414use rustc_hir:: intravisit:: Visitor ;
1515use rustc_hir:: itemlikevisit:: ItemLikeVisitor ;
@@ -154,14 +154,8 @@ impl<'hir> Map<'hir> {
154154 self . tcx . hir_crate ( ( ) )
155155 }
156156
157- #[ inline]
158- pub fn definitions ( & self ) -> & ' hir Definitions {
159- // Accessing the definitions is ok, since all its contents are tracked by the query system.
160- & self . tcx . untracked_resolutions . definitions
161- }
162-
163157 pub fn def_key ( & self , def_id : LocalDefId ) -> DefKey {
164- // Accessing the definitions is ok, since all its contents are tracked by the query system .
158+ // Accessing the DefKey is ok, since it is part of DefPathHash .
165159 self . tcx . untracked_resolutions . definitions . def_key ( def_id)
166160 }
167161
@@ -170,10 +164,16 @@ impl<'hir> Map<'hir> {
170164 }
171165
172166 pub fn def_path ( & self , def_id : LocalDefId ) -> DefPath {
173- // Accessing the definitions is ok, since all its contents are tracked by the query system .
167+ // Accessing the DefPath is ok, since it is part of DefPathHash .
174168 self . tcx . untracked_resolutions . definitions . def_path ( def_id)
175169 }
176170
171+ #[ inline]
172+ pub fn def_path_hash ( self , def_id : LocalDefId ) -> DefPathHash {
173+ // Accessing the DefPathHash is ok, it is incr. comp. stable.
174+ self . tcx . untracked_resolutions . definitions . def_path_hash ( def_id)
175+ }
176+
177177 #[ inline]
178178 pub fn local_def_id ( & self , hir_id : HirId ) -> LocalDefId {
179179 self . opt_local_def_id ( hir_id) . unwrap_or_else ( || {
@@ -187,18 +187,20 @@ impl<'hir> Map<'hir> {
187187
188188 #[ inline]
189189 pub fn opt_local_def_id ( & self , hir_id : HirId ) -> Option < LocalDefId > {
190- // Accessing the definitions is ok, since all its contents are tracked by the query system.
190+ // FIXME(#85914) is this access safe for incr. comp.?
191191 self . tcx . untracked_resolutions . definitions . opt_hir_id_to_local_def_id ( hir_id)
192192 }
193193
194194 #[ inline]
195195 pub fn local_def_id_to_hir_id ( & self , def_id : LocalDefId ) -> HirId {
196- // Accessing the definitions is ok, since all its contents are tracked by the query system.
196+ // FIXME(#85914) is this access safe for incr. comp.?
197197 self . tcx . untracked_resolutions . definitions . local_def_id_to_hir_id ( def_id)
198198 }
199199
200200 pub fn iter_local_def_id ( & self ) -> impl Iterator < Item = LocalDefId > + ' _ {
201- // Accessing the definitions is ok, since all its contents are tracked by the query system.
201+ // Create a dependency to the crate to be sure we reexcute this when the amount of
202+ // definitions change.
203+ self . tcx . ensure ( ) . hir_crate ( ( ) ) ;
202204 self . tcx . untracked_resolutions . definitions . iter_local_def_id ( )
203205 }
204206
0 commit comments