@@ -10,7 +10,7 @@ use rustc_data_structures::captures::Captures;
1010use rustc_data_structures:: fingerprint:: { Fingerprint , FingerprintDecoder } ;
1111use rustc_data_structures:: fx:: FxHashMap ;
1212use rustc_data_structures:: svh:: Svh ;
13- use rustc_data_structures:: sync:: { AtomicCell , Lock , LockGuard , Lrc , OnceCell } ;
13+ use rustc_data_structures:: sync:: { Lock , LockGuard , Lrc , OnceCell } ;
1414use rustc_data_structures:: unhash:: UnhashMap ;
1515use rustc_errors:: ErrorReported ;
1616use rustc_expand:: base:: { SyntaxExtension , SyntaxExtensionKind } ;
@@ -21,7 +21,6 @@ use rustc_hir::def_id::{CrateNum, DefId, DefIndex, CRATE_DEF_INDEX, LOCAL_CRATE}
2121use rustc_hir:: definitions:: { DefKey , DefPath , DefPathData , DefPathHash } ;
2222use rustc_hir:: lang_items;
2323use rustc_index:: vec:: { Idx , IndexVec } ;
24- use rustc_middle:: dep_graph:: { self , DepNode , DepNodeExt , DepNodeIndex } ;
2524use rustc_middle:: hir:: exports:: Export ;
2625use rustc_middle:: middle:: cstore:: { CrateSource , ExternCrate } ;
2726use rustc_middle:: middle:: cstore:: { ForeignModule , LinkagePreference , NativeLib } ;
@@ -84,11 +83,6 @@ crate struct CrateMetadata {
8483 def_path_hash_map : OnceCell < UnhashMap < DefPathHash , DefIndex > > ,
8584 /// Used for decoding interpret::AllocIds in a cached & thread-safe manner.
8685 alloc_decoding_state : AllocDecodingState ,
87- /// The `DepNodeIndex` of the `DepNode` representing this upstream crate.
88- /// It is initialized on the first access in `get_crate_dep_node_index()`.
89- /// Do not access the value directly, as it might not have been initialized yet.
90- /// The field must always be initialized to `DepNodeIndex::INVALID`.
91- dep_node_index : AtomicCell < DepNodeIndex > ,
9286 /// Caches decoded `DefKey`s.
9387 def_key_cache : Lock < FxHashMap < DefIndex , DefKey > > ,
9488 /// Caches decoded `DefPathHash`es.
@@ -1611,31 +1605,6 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
16111605 self . def_path_hash_unlocked ( index, & mut def_path_hashes)
16121606 }
16131607
1614- /// Get the `DepNodeIndex` corresponding this crate. The result of this
1615- /// method is cached in the `dep_node_index` field.
1616- fn get_crate_dep_node_index ( & self , tcx : TyCtxt < ' tcx > ) -> DepNodeIndex {
1617- let mut dep_node_index = self . dep_node_index . load ( ) ;
1618-
1619- if unlikely ! ( dep_node_index == DepNodeIndex :: INVALID ) {
1620- // We have not cached the DepNodeIndex for this upstream crate yet,
1621- // so use the dep-graph to find it out and cache it.
1622- // Note that multiple threads can enter this block concurrently.
1623- // That is fine because the DepNodeIndex remains constant
1624- // throughout the whole compilation session, and multiple stores
1625- // would always write the same value.
1626-
1627- let def_path_hash = self . def_path_hash ( CRATE_DEF_INDEX ) ;
1628- let dep_node =
1629- DepNode :: from_def_path_hash ( def_path_hash, dep_graph:: DepKind :: CrateMetadata ) ;
1630-
1631- dep_node_index = tcx. dep_graph . dep_node_index_of ( & dep_node) ;
1632- assert ! ( dep_node_index != DepNodeIndex :: INVALID ) ;
1633- self . dep_node_index . store ( dep_node_index) ;
1634- }
1635-
1636- dep_node_index
1637- }
1638-
16391608 /// Imports the source_map from an external crate into the source_map of the crate
16401609 /// currently being compiled (the "local crate").
16411610 ///
@@ -1852,7 +1821,6 @@ impl CrateMetadata {
18521821 source_map_import_info : OnceCell :: new ( ) ,
18531822 def_path_hash_map : Default :: default ( ) ,
18541823 alloc_decoding_state,
1855- dep_node_index : AtomicCell :: new ( DepNodeIndex :: INVALID ) ,
18561824 cnum,
18571825 cnum_map,
18581826 dependencies,
0 commit comments