@@ -4,7 +4,6 @@ use crate::hir::map::{Entry, HirOwnerData, Map};
4
4
use crate :: hir:: { HirItem , HirOwner , HirOwnerItems } ;
5
5
use crate :: ich:: StableHashingContext ;
6
6
use crate :: middle:: cstore:: CrateStore ;
7
- use rustc_ast:: ast:: NodeId ;
8
7
use rustc_data_structures:: fingerprint:: Fingerprint ;
9
8
use rustc_data_structures:: fx:: FxHashMap ;
10
9
use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
@@ -39,7 +38,6 @@ pub(super) struct NodeCollector<'a, 'hir> {
39
38
current_dep_node_owner : DefIndex ,
40
39
41
40
definitions : & ' a definitions:: Definitions ,
42
- hir_to_node_id : & ' a FxHashMap < HirId , NodeId > ,
43
41
44
42
hcx : StableHashingContext < ' a > ,
45
43
@@ -98,7 +96,6 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
98
96
arena : & ' hir Arena < ' hir > ,
99
97
krate : & ' hir Crate < ' hir > ,
100
98
definitions : & ' a definitions:: Definitions ,
101
- hir_to_node_id : & ' a FxHashMap < HirId , NodeId > ,
102
99
mut hcx : StableHashingContext < ' a > ,
103
100
) -> NodeCollector < ' a , ' hir > {
104
101
let root_mod_def_path_hash = definitions. def_path_hash ( CRATE_DEF_INDEX ) ;
@@ -131,7 +128,6 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
131
128
parent_node : hir:: CRATE_HIR_ID ,
132
129
current_dep_node_owner : CRATE_DEF_INDEX ,
133
130
definitions,
134
- hir_to_node_id,
135
131
hcx,
136
132
hir_body_nodes,
137
133
map : ( 0 ..definitions. def_index_count ( ) )
@@ -244,7 +240,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
244
240
// Make sure that the DepNode of some node coincides with the HirId
245
241
// owner of that node.
246
242
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) ;
248
244
assert_eq ! ( self . definitions. node_to_hir_id( node_id) , hir_id) ;
249
245
250
246
if hir_id. owner != self . current_dep_node_owner {
@@ -345,7 +341,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
345
341
debug ! ( "visit_item: {:?}" , i) ;
346
342
debug_assert_eq ! (
347
343
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( )
349
345
) ;
350
346
self . with_dep_node_owner ( i. hir_id . owner , i, |this, hash| {
351
347
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> {
377
373
fn visit_trait_item ( & mut self , ti : & ' hir TraitItem < ' hir > ) {
378
374
debug_assert_eq ! (
379
375
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( )
381
377
) ;
382
378
self . with_dep_node_owner ( ti. hir_id . owner , ti, |this, hash| {
383
379
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> {
391
387
fn visit_impl_item ( & mut self , ii : & ' hir ImplItem < ' hir > ) {
392
388
debug_assert_eq ! (
393
389
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( )
395
391
) ;
396
392
self . with_dep_node_owner ( ii. hir_id . owner , ii, |this, hash| {
397
393
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> {
510
506
}
511
507
512
508
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 ) ;
514
510
let def_index = self . definitions . opt_def_index ( node_id) . unwrap ( ) ;
515
511
516
512
self . with_dep_node_owner ( def_index, macro_def, |this, hash| {
0 commit comments