@@ -56,7 +56,6 @@ use rustc_hir::def::{
56
56
} ;
57
57
use rustc_hir:: def_id:: { CRATE_DEF_ID , CrateNum , DefId , LOCAL_CRATE , LocalDefId , LocalDefIdMap } ;
58
58
use rustc_hir:: { PrimTy , TraitCandidate } ;
59
- use rustc_index:: IndexVec ;
60
59
use rustc_metadata:: creader:: { CStore , CrateLoader } ;
61
60
use rustc_middle:: metadata:: ModChild ;
62
61
use rustc_middle:: middle:: privacy:: EffectiveVisibilities ;
@@ -1184,7 +1183,6 @@ pub struct Resolver<'ra, 'tcx> {
1184
1183
next_node_id : NodeId ,
1185
1184
1186
1185
node_id_to_def_id : NodeMap < Feed < ' tcx , LocalDefId > > ,
1187
- def_id_to_node_id : IndexVec < LocalDefId , ast:: NodeId > ,
1188
1186
1189
1187
/// Indices of unnamed struct or variant fields with unresolved attributes.
1190
1188
placeholder_field_indices : FxHashMap < NodeId , usize > ,
@@ -1369,7 +1367,6 @@ impl<'tcx> Resolver<'_, 'tcx> {
1369
1367
debug ! ( "create_def: def_id_to_node_id[{:?}] <-> {:?}" , def_id, node_id) ;
1370
1368
self . node_id_to_def_id . insert ( node_id, feed. downgrade ( ) ) ;
1371
1369
}
1372
- assert_eq ! ( self . def_id_to_node_id. push( node_id) , def_id) ;
1373
1370
1374
1371
feed
1375
1372
}
@@ -1385,6 +1382,15 @@ impl<'tcx> Resolver<'_, 'tcx> {
1385
1382
pub fn tcx ( & self ) -> TyCtxt < ' tcx > {
1386
1383
self . tcx
1387
1384
}
1385
+
1386
+ fn def_id_to_node_id ( & self , def_id : LocalDefId ) -> NodeId {
1387
+ self . node_id_to_def_id
1388
+ . items ( )
1389
+ . filter ( |( _, v) | v. key ( ) == def_id)
1390
+ . map ( |( k, _) | * k)
1391
+ . take_sole_item ( )
1392
+ . unwrap ( )
1393
+ }
1388
1394
}
1389
1395
1390
1396
impl < ' ra , ' tcx > Resolver < ' ra , ' tcx > {
@@ -1417,8 +1423,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1417
1423
& mut Default :: default ( ) ,
1418
1424
) ;
1419
1425
1420
- let mut def_id_to_node_id = IndexVec :: default ( ) ;
1421
- assert_eq ! ( def_id_to_node_id. push( CRATE_NODE_ID ) , CRATE_DEF_ID ) ;
1422
1426
let mut node_id_to_def_id = NodeMap :: default ( ) ;
1423
1427
let crate_feed = tcx. create_local_crate_def_id ( crate_span) ;
1424
1428
@@ -1553,7 +1557,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1553
1557
lint_buffer : LintBuffer :: default ( ) ,
1554
1558
next_node_id : CRATE_NODE_ID ,
1555
1559
node_id_to_def_id,
1556
- def_id_to_node_id,
1557
1560
placeholder_field_indices : Default :: default ( ) ,
1558
1561
invocation_parents,
1559
1562
legacy_const_generic_args : Default :: default ( ) ,
0 commit comments