@@ -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.
@@ -1592,31 +1586,6 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
15921586 self . def_path_hash_unlocked ( index, & mut def_path_hashes)
15931587 }
15941588
1595- /// Get the `DepNodeIndex` corresponding this crate. The result of this
1596- /// method is cached in the `dep_node_index` field.
1597- fn get_crate_dep_node_index ( & self , tcx : TyCtxt < ' tcx > ) -> DepNodeIndex {
1598- let mut dep_node_index = self . dep_node_index . load ( ) ;
1599-
1600- if unlikely ! ( dep_node_index == DepNodeIndex :: INVALID ) {
1601- // We have not cached the DepNodeIndex for this upstream crate yet,
1602- // so use the dep-graph to find it out and cache it.
1603- // Note that multiple threads can enter this block concurrently.
1604- // That is fine because the DepNodeIndex remains constant
1605- // throughout the whole compilation session, and multiple stores
1606- // would always write the same value.
1607-
1608- let def_path_hash = self . def_path_hash ( CRATE_DEF_INDEX ) ;
1609- let dep_node =
1610- DepNode :: from_def_path_hash ( def_path_hash, dep_graph:: DepKind :: CrateMetadata ) ;
1611-
1612- dep_node_index = tcx. dep_graph . dep_node_index_of ( & dep_node) ;
1613- assert ! ( dep_node_index != DepNodeIndex :: INVALID ) ;
1614- self . dep_node_index . store ( dep_node_index) ;
1615- }
1616-
1617- dep_node_index
1618- }
1619-
16201589 /// Imports the source_map from an external crate into the source_map of the crate
16211590 /// currently being compiled (the "local crate").
16221591 ///
@@ -1833,7 +1802,6 @@ impl CrateMetadata {
18331802 source_map_import_info : OnceCell :: new ( ) ,
18341803 def_path_hash_map : Default :: default ( ) ,
18351804 alloc_decoding_state,
1836- dep_node_index : AtomicCell :: new ( DepNodeIndex :: INVALID ) ,
18371805 cnum,
18381806 cnum_map,
18391807 dependencies,
0 commit comments