@@ -4,7 +4,6 @@ use crate::hir::map::{Entry, HirOwnerData, Map};
44use crate :: hir:: { HirItem , HirOwner , HirOwnerItems } ;
55use crate :: ich:: StableHashingContext ;
66use crate :: middle:: cstore:: CrateStore ;
7- use rustc_ast:: ast:: NodeId ;
87use rustc_data_structures:: fingerprint:: Fingerprint ;
98use rustc_data_structures:: fx:: FxHashMap ;
109use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
@@ -39,7 +38,6 @@ pub(super) struct NodeCollector<'a, 'hir> {
3938 current_dep_node_owner : DefIndex ,
4039
4140 definitions : & ' a definitions:: Definitions ,
42- hir_to_node_id : & ' a FxHashMap < HirId , NodeId > ,
4341
4442 hcx : StableHashingContext < ' a > ,
4543
@@ -98,7 +96,6 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
9896 arena : & ' hir Arena < ' hir > ,
9997 krate : & ' hir Crate < ' hir > ,
10098 definitions : & ' a definitions:: Definitions ,
101- hir_to_node_id : & ' a FxHashMap < HirId , NodeId > ,
10299 mut hcx : StableHashingContext < ' a > ,
103100 ) -> NodeCollector < ' a , ' hir > {
104101 let root_mod_def_path_hash = definitions. def_path_hash ( CRATE_DEF_INDEX ) ;
@@ -131,7 +128,6 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
131128 parent_node : hir:: CRATE_HIR_ID ,
132129 current_dep_node_owner : CRATE_DEF_INDEX ,
133130 definitions,
134- hir_to_node_id,
135131 hcx,
136132 hir_body_nodes,
137133 map : ( 0 ..definitions. def_index_count ( ) )
@@ -244,7 +240,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
244240 // Make sure that the DepNode of some node coincides with the HirId
245241 // owner of that node.
246242 if cfg ! ( debug_assertions) {
247- let node_id = self . hir_to_node_id [ & hir_id] ;
243+ let node_id = self . definitions . hir_to_node_id ( hir_id) ;
248244 assert_eq ! ( self . definitions. node_to_hir_id( node_id) , hir_id) ;
249245
250246 if hir_id. owner != self . current_dep_node_owner {
@@ -345,7 +341,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
345341 debug ! ( "visit_item: {:?}" , i) ;
346342 debug_assert_eq ! (
347343 i. hir_id. owner,
348- self . definitions. opt_def_index( self . hir_to_node_id[ & i. hir_id] ) . unwrap( )
344+ self . definitions. opt_def_index( self . definitions . hir_to_node_id( i. hir_id) ) . unwrap( )
349345 ) ;
350346 self . with_dep_node_owner ( i. hir_id . owner , i, |this, hash| {
351347 this. insert_with_hash ( i. span , i. hir_id , Node :: Item ( i) , hash) ;
@@ -377,7 +373,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
377373 fn visit_trait_item ( & mut self , ti : & ' hir TraitItem < ' hir > ) {
378374 debug_assert_eq ! (
379375 ti. hir_id. owner,
380- self . definitions. opt_def_index( self . hir_to_node_id[ & ti. hir_id] ) . unwrap( )
376+ self . definitions. opt_def_index( self . definitions . hir_to_node_id( ti. hir_id) ) . unwrap( )
381377 ) ;
382378 self . with_dep_node_owner ( ti. hir_id . owner , ti, |this, hash| {
383379 this. insert_with_hash ( ti. span , ti. hir_id , Node :: TraitItem ( ti) , hash) ;
@@ -391,7 +387,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
391387 fn visit_impl_item ( & mut self , ii : & ' hir ImplItem < ' hir > ) {
392388 debug_assert_eq ! (
393389 ii. hir_id. owner,
394- self . definitions. opt_def_index( self . hir_to_node_id[ & ii. hir_id] ) . unwrap( )
390+ self . definitions. opt_def_index( self . definitions . hir_to_node_id( ii. hir_id) ) . unwrap( )
395391 ) ;
396392 self . with_dep_node_owner ( ii. hir_id . owner , ii, |this, hash| {
397393 this. insert_with_hash ( ii. span , ii. hir_id , Node :: ImplItem ( ii) , hash) ;
@@ -510,7 +506,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
510506 }
511507
512508 fn visit_macro_def ( & mut self , macro_def : & ' hir MacroDef < ' hir > ) {
513- let node_id = self . hir_to_node_id [ & macro_def. hir_id ] ;
509+ let node_id = self . definitions . hir_to_node_id ( macro_def. hir_id ) ;
514510 let def_index = self . definitions . opt_def_index ( node_id) . unwrap ( ) ;
515511
516512 self . with_dep_node_owner ( def_index, macro_def, |this, hash| {
0 commit comments