@@ -10,7 +10,7 @@ use rustc_data_structures::thin_vec::ThinVec;
10
10
use rustc_data_structures:: unhash:: UnhashMap ;
11
11
use rustc_errors:: Diagnostic ;
12
12
use rustc_hir:: def_id:: { CrateNum , DefId , DefIndex , LocalDefId , LOCAL_CRATE } ;
13
- use rustc_hir:: definitions:: { DefPathHash , DefPathTable } ;
13
+ use rustc_hir:: definitions:: DefPathHash ;
14
14
use rustc_index:: vec:: { Idx , IndexVec } ;
15
15
use rustc_query_system:: dep_graph:: DepContext ;
16
16
use rustc_query_system:: query:: QueryContext ;
@@ -27,7 +27,6 @@ use rustc_span::source_map::{SourceMap, StableSourceFileId};
27
27
use rustc_span:: CachingSourceMapView ;
28
28
use rustc_span:: { BytePos , ExpnData , SourceFile , Span , DUMMY_SP } ;
29
29
use std:: collections:: hash_map:: Entry ;
30
- use std:: iter:: FromIterator ;
31
30
use std:: mem;
32
31
33
32
const TAG_FILE_FOOTER : u128 = 0xC0FFEE_C0FFEE_C0FFEE_C0FFEE_C0FFEE ;
@@ -103,12 +102,6 @@ pub struct OnDiskCache<'sess> {
103
102
// during the next compilation session.
104
103
latest_foreign_def_path_hashes : Lock < UnhashMap < DefPathHash , RawDefId > > ,
105
104
106
- // Maps `DefPathHashes` to their corresponding `LocalDefId`s for all
107
- // local items in the current compilation session. This is only populated
108
- // when we are in incremental mode and have loaded a pre-existing cache
109
- // from disk, since this map is only used when deserializing a `DefPathHash`
110
- // from the incremental cache.
111
- local_def_path_hash_to_def_id : UnhashMap < DefPathHash , LocalDefId > ,
112
105
// Caches all lookups of `DefPathHashes`, both for local and foreign
113
106
// definitions. A definition from the previous compilation session
114
107
// may no longer exist in the current compilation session, so
@@ -168,12 +161,7 @@ crate struct RawDefId {
168
161
169
162
impl < ' sess > OnDiskCache < ' sess > {
170
163
/// Creates a new `OnDiskCache` instance from the serialized data in `data`.
171
- pub fn new (
172
- sess : & ' sess Session ,
173
- data : Vec < u8 > ,
174
- start_pos : usize ,
175
- def_path_table : & DefPathTable ,
176
- ) -> Self {
164
+ pub fn new ( sess : & ' sess Session , data : Vec < u8 > , start_pos : usize ) -> Self {
177
165
debug_assert ! ( sess. opts. incremental. is_some( ) ) ;
178
166
179
167
// Wrap in a scope so we can borrow `data`.
@@ -210,11 +198,6 @@ impl<'sess> OnDiskCache<'sess> {
210
198
hygiene_context : Default :: default ( ) ,
211
199
foreign_def_path_hashes : footer. foreign_def_path_hashes ,
212
200
latest_foreign_def_path_hashes : Default :: default ( ) ,
213
- local_def_path_hash_to_def_id : UnhashMap :: from_iter (
214
- def_path_table
215
- . all_def_path_hashes_and_def_ids ( LOCAL_CRATE )
216
- . map ( |( hash, def_id) | ( hash, def_id. as_local ( ) . unwrap ( ) ) ) ,
217
- ) ,
218
201
def_path_hash_to_def_id_cache : Default :: default ( ) ,
219
202
}
220
203
}
@@ -236,7 +219,6 @@ impl<'sess> OnDiskCache<'sess> {
236
219
hygiene_context : Default :: default ( ) ,
237
220
foreign_def_path_hashes : Default :: default ( ) ,
238
221
latest_foreign_def_path_hashes : Default :: default ( ) ,
239
- local_def_path_hash_to_def_id : Default :: default ( ) ,
240
222
def_path_hash_to_def_id_cache : Default :: default ( ) ,
241
223
}
242
224
}
@@ -616,7 +598,7 @@ impl<'sess> OnDiskCache<'sess> {
616
598
debug ! ( "def_path_hash_to_def_id({:?})" , hash) ;
617
599
// Check if the `DefPathHash` corresponds to a definition in the current
618
600
// crate
619
- if let Some ( def_id) = self . local_def_path_hash_to_def_id . get ( & hash) . cloned ( ) {
601
+ if let Some ( def_id) = tcx . definitions . local_def_path_hash_to_def_id ( hash) {
620
602
let def_id = def_id. to_def_id ( ) ;
621
603
e. insert ( Some ( def_id) ) ;
622
604
return Some ( def_id) ;
0 commit comments