@@ -10,7 +10,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
1010use rustc_data_structures:: svh:: Svh ;
1111use rustc_hir as hir;
1212use rustc_hir:: def_id:: CRATE_DEF_INDEX ;
13- use rustc_hir:: def_id:: { DefIndex , LOCAL_CRATE } ;
13+ use rustc_hir:: def_id:: { LocalDefId , LOCAL_CRATE } ;
1414use rustc_hir:: intravisit:: { self , NestedVisitorMap , Visitor } ;
1515use rustc_hir:: * ;
1616use rustc_index:: vec:: { Idx , IndexVec } ;
@@ -30,12 +30,12 @@ pub(super) struct NodeCollector<'a, 'hir> {
3030 /// Source map
3131 source_map : & ' a SourceMap ,
3232
33- map : IndexVec < DefIndex , HirOwnerData < ' hir > > ,
33+ map : IndexVec < LocalDefId , HirOwnerData < ' hir > > ,
3434
3535 /// The parent of this node
3636 parent_node : hir:: HirId ,
3737
38- current_dep_node_owner : DefIndex ,
38+ current_dep_node_owner : LocalDefId ,
3939
4040 definitions : & ' a definitions:: Definitions ,
4141
@@ -126,7 +126,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
126126 krate,
127127 source_map : sess. source_map ( ) ,
128128 parent_node : hir:: CRATE_HIR_ID ,
129- current_dep_node_owner : CRATE_DEF_INDEX ,
129+ current_dep_node_owner : LocalDefId { local_def_index : CRATE_DEF_INDEX } ,
130130 definitions,
131131 hcx,
132132 hir_body_nodes,
@@ -148,7 +148,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
148148 crate_disambiguator : CrateDisambiguator ,
149149 cstore : & dyn CrateStore ,
150150 commandline_args_hash : u64 ,
151- ) -> ( IndexVec < DefIndex , HirOwnerData < ' hir > > , Svh ) {
151+ ) -> ( IndexVec < LocalDefId , HirOwnerData < ' hir > > , Svh ) {
152152 // Insert bodies into the map
153153 for ( id, body) in self . krate . bodies . iter ( ) {
154154 let bodies = & mut self . map [ id. hir_id . owner ] . with_bodies . as_mut ( ) . unwrap ( ) . bodies ;
@@ -261,9 +261,11 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
261261 current_dep_node_owner={} ({:?}), hir_id.owner={} ({:?}){}",
262262 self . source_map. span_to_string( span) ,
263263 node_str,
264- self . definitions. def_path( self . current_dep_node_owner) . to_string_no_crate( ) ,
264+ self . definitions
265+ . def_path( self . current_dep_node_owner. local_def_index)
266+ . to_string_no_crate( ) ,
265267 self . current_dep_node_owner,
266- self . definitions. def_path( hir_id. owner) . to_string_no_crate( ) ,
268+ self . definitions. def_path( hir_id. owner. local_def_index ) . to_string_no_crate( ) ,
267269 hir_id. owner,
268270 forgot_str,
269271 )
@@ -285,13 +287,13 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
285287 F : FnOnce ( & mut Self , Fingerprint ) ,
286288 > (
287289 & mut self ,
288- dep_node_owner : DefIndex ,
290+ dep_node_owner : LocalDefId ,
289291 item_like : & T ,
290292 f : F ,
291293 ) {
292294 let prev_owner = self . current_dep_node_owner ;
293295
294- let def_path_hash = self . definitions . def_path_hash ( dep_node_owner) ;
296+ let def_path_hash = self . definitions . def_path_hash ( dep_node_owner. local_def_index ) ;
295297
296298 let hash = hash_body ( & mut self . hcx , def_path_hash, item_like, & mut self . hir_body_nodes ) ;
297299
@@ -340,7 +342,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
340342 fn visit_item ( & mut self , i : & ' hir Item < ' hir > ) {
341343 debug ! ( "visit_item: {:?}" , i) ;
342344 debug_assert_eq ! (
343- i. hir_id. owner,
345+ i. hir_id. owner. local_def_index ,
344346 self . definitions. opt_def_index( self . definitions. hir_to_node_id( i. hir_id) ) . unwrap( )
345347 ) ;
346348 self . with_dep_node_owner ( i. hir_id . owner , i, |this, hash| {
@@ -372,7 +374,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
372374
373375 fn visit_trait_item ( & mut self , ti : & ' hir TraitItem < ' hir > ) {
374376 debug_assert_eq ! (
375- ti. hir_id. owner,
377+ ti. hir_id. owner. local_def_index ,
376378 self . definitions. opt_def_index( self . definitions. hir_to_node_id( ti. hir_id) ) . unwrap( )
377379 ) ;
378380 self . with_dep_node_owner ( ti. hir_id . owner , ti, |this, hash| {
@@ -386,7 +388,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
386388
387389 fn visit_impl_item ( & mut self , ii : & ' hir ImplItem < ' hir > ) {
388390 debug_assert_eq ! (
389- ii. hir_id. owner,
391+ ii. hir_id. owner. local_def_index ,
390392 self . definitions. opt_def_index( self . definitions. hir_to_node_id( ii. hir_id) ) . unwrap( )
391393 ) ;
392394 self . with_dep_node_owner ( ii. hir_id . owner , ii, |this, hash| {
@@ -506,10 +508,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
506508 }
507509
508510 fn visit_macro_def ( & mut self , macro_def : & ' hir MacroDef < ' hir > ) {
509- let node_id = self . definitions . hir_to_node_id ( macro_def. hir_id ) ;
510- let def_index = self . definitions . opt_def_index ( node_id) . unwrap ( ) ;
511-
512- self . with_dep_node_owner ( def_index, macro_def, |this, hash| {
511+ self . with_dep_node_owner ( macro_def. hir_id . owner , macro_def, |this, hash| {
513512 this. insert_with_hash (
514513 macro_def. span ,
515514 macro_def. hir_id ,
0 commit comments