@@ -242,8 +242,10 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
242
242
// Make sure that the DepNode of some node coincides with the HirId
243
243
// owner of that node.
244
244
if cfg ! ( debug_assertions) {
245
+ let node_id = self . definitions . hir_id_to_node_id ( hir_id) ;
246
+
245
247
if hir_id. owner != self . current_dep_node_owner {
246
- let node_str = match self . definitions . opt_hir_id_to_local_def_id ( hir_id ) {
248
+ let node_str = match self . definitions . opt_local_def_id ( node_id ) {
247
249
Some ( def_id) => self . definitions . def_path ( def_id) . to_string_no_crate ( ) ,
248
250
None => format ! ( "{:?}" , node) ,
249
251
} ;
@@ -333,7 +335,9 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
333
335
debug ! ( "visit_item: {:?}" , i) ;
334
336
debug_assert_eq ! (
335
337
i. hir_id. owner,
336
- self . definitions. opt_hir_id_to_local_def_id( i. hir_id) . unwrap( )
338
+ self . definitions
339
+ . opt_local_def_id( self . definitions. hir_id_to_node_id( i. hir_id) )
340
+ . unwrap( )
337
341
) ;
338
342
self . with_dep_node_owner ( i. hir_id . owner , i, |this, hash| {
339
343
this. insert_with_hash ( i. span , i. hir_id , Node :: Item ( i) , hash) ;
@@ -365,7 +369,9 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
365
369
fn visit_trait_item ( & mut self , ti : & ' hir TraitItem < ' hir > ) {
366
370
debug_assert_eq ! (
367
371
ti. hir_id. owner,
368
- self . definitions. opt_hir_id_to_local_def_id( ti. hir_id) . unwrap( )
372
+ self . definitions
373
+ . opt_local_def_id( self . definitions. hir_id_to_node_id( ti. hir_id) )
374
+ . unwrap( )
369
375
) ;
370
376
self . with_dep_node_owner ( ti. hir_id . owner , ti, |this, hash| {
371
377
this. insert_with_hash ( ti. span , ti. hir_id , Node :: TraitItem ( ti) , hash) ;
@@ -379,7 +385,9 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
379
385
fn visit_impl_item ( & mut self , ii : & ' hir ImplItem < ' hir > ) {
380
386
debug_assert_eq ! (
381
387
ii. hir_id. owner,
382
- self . definitions. opt_hir_id_to_local_def_id( ii. hir_id) . unwrap( )
388
+ self . definitions
389
+ . opt_local_def_id( self . definitions. hir_id_to_node_id( ii. hir_id) )
390
+ . unwrap( )
383
391
) ;
384
392
self . with_dep_node_owner ( ii. hir_id . owner , ii, |this, hash| {
385
393
this. insert_with_hash ( ii. span , ii. hir_id , Node :: ImplItem ( ii) , hash) ;
0 commit comments