Skip to content

Commit 6a9dbd2

Browse files
committed
Only populate local_def_path_hash_to_def_id when needed
1 parent e935d38 commit 6a9dbd2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Diff for: compiler/rustc_middle/src/ty/query/on_disk_cache.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ pub struct OnDiskCache<'sess> {
9898
latest_foreign_def_path_hashes: Lock<FxHashMap<DefPathHash, RawDefId>>,
9999

100100
// Maps `DefPathHashes` to their corresponding `LocalDefId`s for all
101-
// local items in the current compilation session.
101+
// local items in the current compilation session. This is only populated
102+
// when we are in incremental mode and have loaded a pre-existing cache
103+
// from disk, since this map is only used when deserializing a `DefPathHash`
104+
// from the incremental cache.
102105
local_def_path_hash_to_def_id: FxHashMap<DefPathHash, LocalDefId>,
103106
// Caches all lookups of `DefPathHashes`, both for local and foreign
104107
// definitions. A definition from the previous compilation session
@@ -215,7 +218,7 @@ impl<'sess> OnDiskCache<'sess> {
215218
}
216219
}
217220

218-
pub fn new_empty(source_map: &'sess SourceMap, definitions: &Definitions) -> Self {
221+
pub fn new_empty(source_map: &'sess SourceMap) -> Self {
219222
Self {
220223
serialized_data: Vec::new(),
221224
file_index_to_stable_id: Default::default(),
@@ -232,7 +235,7 @@ impl<'sess> OnDiskCache<'sess> {
232235
hygiene_context: Default::default(),
233236
foreign_def_path_hashes: Default::default(),
234237
latest_foreign_def_path_hashes: Default::default(),
235-
local_def_path_hash_to_def_id: make_local_def_path_hash_map(definitions),
238+
local_def_path_hash_to_def_id: Default::default(),
236239
def_path_hash_to_def_id_cache: Default::default(),
237240
}
238241
}

0 commit comments

Comments
 (0)