@@ -10,7 +10,7 @@ use rustc_data_structures::captures::Captures;
10
10
use rustc_data_structures:: fingerprint:: { Fingerprint , FingerprintDecoder } ;
11
11
use rustc_data_structures:: fx:: FxHashMap ;
12
12
use 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 } ;
14
14
use rustc_data_structures:: unhash:: UnhashMap ;
15
15
use rustc_errors:: ErrorReported ;
16
16
use rustc_expand:: base:: { SyntaxExtension , SyntaxExtensionKind } ;
@@ -21,7 +21,6 @@ use rustc_hir::def_id::{CrateNum, DefId, DefIndex, CRATE_DEF_INDEX, LOCAL_CRATE}
21
21
use rustc_hir:: definitions:: { DefKey , DefPath , DefPathData , DefPathHash } ;
22
22
use rustc_hir:: lang_items;
23
23
use rustc_index:: vec:: { Idx , IndexVec } ;
24
- use rustc_middle:: dep_graph:: { self , DepNode , DepNodeExt , DepNodeIndex } ;
25
24
use rustc_middle:: hir:: exports:: Export ;
26
25
use rustc_middle:: middle:: cstore:: { CrateSource , ExternCrate } ;
27
26
use rustc_middle:: middle:: cstore:: { ForeignModule , LinkagePreference , NativeLib } ;
@@ -84,11 +83,6 @@ crate struct CrateMetadata {
84
83
def_path_hash_map : OnceCell < UnhashMap < DefPathHash , DefIndex > > ,
85
84
/// Used for decoding interpret::AllocIds in a cached & thread-safe manner.
86
85
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 > ,
92
86
/// Caches decoded `DefKey`s.
93
87
def_key_cache : Lock < FxHashMap < DefIndex , DefKey > > ,
94
88
/// Caches decoded `DefPathHash`es.
@@ -1611,31 +1605,6 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1611
1605
self . def_path_hash_unlocked ( index, & mut def_path_hashes)
1612
1606
}
1613
1607
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
-
1639
1608
/// Imports the source_map from an external crate into the source_map of the crate
1640
1609
/// currently being compiled (the "local crate").
1641
1610
///
@@ -1852,7 +1821,6 @@ impl CrateMetadata {
1852
1821
source_map_import_info : OnceCell :: new ( ) ,
1853
1822
def_path_hash_map : Default :: default ( ) ,
1854
1823
alloc_decoding_state,
1855
- dep_node_index : AtomicCell :: new ( DepNodeIndex :: INVALID ) ,
1856
1824
cnum,
1857
1825
cnum_map,
1858
1826
dependencies,
0 commit comments