@@ -10,7 +10,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
10
10
use rustc_data_structures:: svh:: Svh ;
11
11
use rustc_hir as hir;
12
12
use 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 } ;
14
14
use rustc_hir:: intravisit:: { self , NestedVisitorMap , Visitor } ;
15
15
use rustc_hir:: * ;
16
16
use rustc_index:: vec:: { Idx , IndexVec } ;
@@ -30,12 +30,12 @@ pub(super) struct NodeCollector<'a, 'hir> {
30
30
/// Source map
31
31
source_map : & ' a SourceMap ,
32
32
33
- map : IndexVec < DefIndex , HirOwnerData < ' hir > > ,
33
+ map : IndexVec < LocalDefId , HirOwnerData < ' hir > > ,
34
34
35
35
/// The parent of this node
36
36
parent_node : hir:: HirId ,
37
37
38
- current_dep_node_owner : DefIndex ,
38
+ current_dep_node_owner : LocalDefId ,
39
39
40
40
definitions : & ' a definitions:: Definitions ,
41
41
@@ -126,7 +126,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
126
126
krate,
127
127
source_map : sess. source_map ( ) ,
128
128
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 } ,
130
130
definitions,
131
131
hcx,
132
132
hir_body_nodes,
@@ -148,7 +148,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
148
148
crate_disambiguator : CrateDisambiguator ,
149
149
cstore : & dyn CrateStore ,
150
150
commandline_args_hash : u64 ,
151
- ) -> ( IndexVec < DefIndex , HirOwnerData < ' hir > > , Svh ) {
151
+ ) -> ( IndexVec < LocalDefId , HirOwnerData < ' hir > > , Svh ) {
152
152
// Insert bodies into the map
153
153
for ( id, body) in self . krate . bodies . iter ( ) {
154
154
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> {
261
261
current_dep_node_owner={} ({:?}), hir_id.owner={} ({:?}){}",
262
262
self . source_map. span_to_string( span) ,
263
263
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( ) ,
265
267
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( ) ,
267
269
hir_id. owner,
268
270
forgot_str,
269
271
)
@@ -285,13 +287,13 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
285
287
F : FnOnce ( & mut Self , Fingerprint ) ,
286
288
> (
287
289
& mut self ,
288
- dep_node_owner : DefIndex ,
290
+ dep_node_owner : LocalDefId ,
289
291
item_like : & T ,
290
292
f : F ,
291
293
) {
292
294
let prev_owner = self . current_dep_node_owner ;
293
295
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 ) ;
295
297
296
298
let hash = hash_body ( & mut self . hcx , def_path_hash, item_like, & mut self . hir_body_nodes ) ;
297
299
@@ -340,7 +342,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
340
342
fn visit_item ( & mut self , i : & ' hir Item < ' hir > ) {
341
343
debug ! ( "visit_item: {:?}" , i) ;
342
344
debug_assert_eq ! (
343
- i. hir_id. owner,
345
+ i. hir_id. owner. local_def_index ,
344
346
self . definitions. opt_def_index( self . definitions. hir_to_node_id( i. hir_id) ) . unwrap( )
345
347
) ;
346
348
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> {
372
374
373
375
fn visit_trait_item ( & mut self , ti : & ' hir TraitItem < ' hir > ) {
374
376
debug_assert_eq ! (
375
- ti. hir_id. owner,
377
+ ti. hir_id. owner. local_def_index ,
376
378
self . definitions. opt_def_index( self . definitions. hir_to_node_id( ti. hir_id) ) . unwrap( )
377
379
) ;
378
380
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> {
386
388
387
389
fn visit_impl_item ( & mut self , ii : & ' hir ImplItem < ' hir > ) {
388
390
debug_assert_eq ! (
389
- ii. hir_id. owner,
391
+ ii. hir_id. owner. local_def_index ,
390
392
self . definitions. opt_def_index( self . definitions. hir_to_node_id( ii. hir_id) ) . unwrap( )
391
393
) ;
392
394
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> {
506
508
}
507
509
508
510
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| {
513
512
this. insert_with_hash (
514
513
macro_def. span ,
515
514
macro_def. hir_id ,
0 commit comments