@@ -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.
@@ -1592,31 +1586,6 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1592
1586
self . def_path_hash_unlocked ( index, & mut def_path_hashes)
1593
1587
}
1594
1588
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
-
1620
1589
/// Imports the source_map from an external crate into the source_map of the crate
1621
1590
/// currently being compiled (the "local crate").
1622
1591
///
@@ -1833,7 +1802,6 @@ impl CrateMetadata {
1833
1802
source_map_import_info : OnceCell :: new ( ) ,
1834
1803
def_path_hash_map : Default :: default ( ) ,
1835
1804
alloc_decoding_state,
1836
- dep_node_index : AtomicCell :: new ( DepNodeIndex :: INVALID ) ,
1837
1805
cnum,
1838
1806
cnum_map,
1839
1807
dependencies,
0 commit comments