@@ -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
@@ -98,7 +98,8 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
9898 definitions : & ' a definitions:: Definitions ,
9999 mut hcx : StableHashingContext < ' a > ,
100100 ) -> NodeCollector < ' a , ' hir > {
101- let root_mod_def_path_hash = definitions. def_path_hash ( CRATE_DEF_INDEX ) ;
101+ let root_mod_def_path_hash =
102+ definitions. def_path_hash ( LocalDefId { local_def_index : CRATE_DEF_INDEX } ) ;
102103
103104 let mut hir_body_nodes = Vec :: new ( ) ;
104105
@@ -126,7 +127,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
126127 krate,
127128 source_map : sess. source_map ( ) ,
128129 parent_node : hir:: CRATE_HIR_ID ,
129- current_dep_node_owner : CRATE_DEF_INDEX ,
130+ current_dep_node_owner : LocalDefId { local_def_index : CRATE_DEF_INDEX } ,
130131 definitions,
131132 hcx,
132133 hir_body_nodes,
@@ -148,7 +149,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
148149 crate_disambiguator : CrateDisambiguator ,
149150 cstore : & dyn CrateStore ,
150151 commandline_args_hash : u64 ,
151- ) -> ( IndexVec < DefIndex , HirOwnerData < ' hir > > , Svh ) {
152+ ) -> ( IndexVec < LocalDefId , HirOwnerData < ' hir > > , Svh ) {
152153 // Insert bodies into the map
153154 for ( id, body) in self . krate . bodies . iter ( ) {
154155 let bodies = & mut self . map [ id. hir_id . owner ] . with_bodies . as_mut ( ) . unwrap ( ) . bodies ;
@@ -244,8 +245,8 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
244245 assert_eq ! ( self . definitions. node_to_hir_id( node_id) , hir_id) ;
245246
246247 if hir_id. owner != self . current_dep_node_owner {
247- let node_str = match self . definitions . opt_def_index ( node_id) {
248- Some ( def_index ) => self . definitions . def_path ( def_index ) . to_string_no_crate ( ) ,
248+ let node_str = match self . definitions . opt_local_def_id ( node_id) {
249+ Some ( def_id ) => self . definitions . def_path ( def_id ) . to_string_no_crate ( ) ,
249250 None => format ! ( "{:?}" , node) ,
250251 } ;
251252
@@ -285,7 +286,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
285286 F : FnOnce ( & mut Self , Fingerprint ) ,
286287 > (
287288 & mut self ,
288- dep_node_owner : DefIndex ,
289+ dep_node_owner : LocalDefId ,
289290 item_like : & T ,
290291 f : F ,
291292 ) {
@@ -341,7 +342,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
341342 debug ! ( "visit_item: {:?}" , i) ;
342343 debug_assert_eq ! (
343344 i. hir_id. owner,
344- self . definitions. opt_def_index ( self . definitions. hir_to_node_id( i. hir_id) ) . unwrap( )
345+ self . definitions. opt_local_def_id ( self . definitions. hir_to_node_id( i. hir_id) ) . unwrap( )
345346 ) ;
346347 self . with_dep_node_owner ( i. hir_id . owner , i, |this, hash| {
347348 this. insert_with_hash ( i. span , i. hir_id , Node :: Item ( i) , hash) ;
@@ -373,7 +374,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
373374 fn visit_trait_item ( & mut self , ti : & ' hir TraitItem < ' hir > ) {
374375 debug_assert_eq ! (
375376 ti. hir_id. owner,
376- self . definitions. opt_def_index ( self . definitions. hir_to_node_id( ti. hir_id) ) . unwrap( )
377+ self . definitions. opt_local_def_id ( self . definitions. hir_to_node_id( ti. hir_id) ) . unwrap( )
377378 ) ;
378379 self . with_dep_node_owner ( ti. hir_id . owner , ti, |this, hash| {
379380 this. insert_with_hash ( ti. span , ti. hir_id , Node :: TraitItem ( ti) , hash) ;
@@ -387,7 +388,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
387388 fn visit_impl_item ( & mut self , ii : & ' hir ImplItem < ' hir > ) {
388389 debug_assert_eq ! (
389390 ii. hir_id. owner,
390- self . definitions. opt_def_index ( self . definitions. hir_to_node_id( ii. hir_id) ) . unwrap( )
391+ self . definitions. opt_local_def_id ( self . definitions. hir_to_node_id( ii. hir_id) ) . unwrap( )
391392 ) ;
392393 self . with_dep_node_owner ( ii. hir_id . owner , ii, |this, hash| {
393394 this. insert_with_hash ( ii. span , ii. hir_id , Node :: ImplItem ( ii) , hash) ;
@@ -506,10 +507,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
506507 }
507508
508509 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| {
510+ self . with_dep_node_owner ( macro_def. hir_id . owner , macro_def, |this, hash| {
513511 this. insert_with_hash (
514512 macro_def. span ,
515513 macro_def. hir_id ,
0 commit comments