@@ -56,7 +56,6 @@ use rustc_hir::def::{
5656} ;
5757use rustc_hir:: def_id:: { CRATE_DEF_ID , CrateNum , DefId , LOCAL_CRATE , LocalDefId , LocalDefIdMap } ;
5858use rustc_hir:: { PrimTy , TraitCandidate } ;
59- use rustc_index:: IndexVec ;
6059use rustc_metadata:: creader:: { CStore , CrateLoader } ;
6160use rustc_middle:: metadata:: ModChild ;
6261use rustc_middle:: middle:: privacy:: EffectiveVisibilities ;
@@ -1184,7 +1183,6 @@ pub struct Resolver<'ra, 'tcx> {
11841183 next_node_id : NodeId ,
11851184
11861185 node_id_to_def_id : NodeMap < Feed < ' tcx , LocalDefId > > ,
1187- def_id_to_node_id : IndexVec < LocalDefId , ast:: NodeId > ,
11881186
11891187 /// Indices of unnamed struct or variant fields with unresolved attributes.
11901188 placeholder_field_indices : FxHashMap < NodeId , usize > ,
@@ -1369,7 +1367,6 @@ impl<'tcx> Resolver<'_, 'tcx> {
13691367 debug ! ( "create_def: def_id_to_node_id[{:?}] <-> {:?}" , def_id, node_id) ;
13701368 self . node_id_to_def_id . insert ( node_id, feed. downgrade ( ) ) ;
13711369 }
1372- assert_eq ! ( self . def_id_to_node_id. push( node_id) , def_id) ;
13731370
13741371 feed
13751372 }
@@ -1385,6 +1382,15 @@ impl<'tcx> Resolver<'_, 'tcx> {
13851382 pub fn tcx ( & self ) -> TyCtxt < ' tcx > {
13861383 self . tcx
13871384 }
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+ }
13881394}
13891395
13901396impl < ' ra , ' tcx > Resolver < ' ra , ' tcx > {
@@ -1417,8 +1423,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
14171423 & mut Default :: default ( ) ,
14181424 ) ;
14191425
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 ) ;
14221426 let mut node_id_to_def_id = NodeMap :: default ( ) ;
14231427 let crate_feed = tcx. create_local_crate_def_id ( crate_span) ;
14241428
@@ -1553,7 +1557,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
15531557 lint_buffer : LintBuffer :: default ( ) ,
15541558 next_node_id : CRATE_NODE_ID ,
15551559 node_id_to_def_id,
1556- def_id_to_node_id,
15571560 placeholder_field_indices : Default :: default ( ) ,
15581561 invocation_parents,
15591562 legacy_const_generic_args : Default :: default ( ) ,
0 commit comments