diff options
| author | Aaron Hill <aa1ronham@gmail.com> | 2020-11-19 15:24:57 -0500 |
|---|---|---|
| committer | Aaron Hill <aa1ronham@gmail.com> | 2020-11-25 14:49:44 -0500 |
| commit | 6a9dbd2e0ec6b4c882668c0d35272b2ee4c03c6e (patch) | |
| tree | a47c744c49126d1aea0a10856f1b5ff89bba4d31 | |
| parent | e935d3832cd8f0c3c3e1f01864e2605a3818b9d9 (diff) | |
| download | rust-6a9dbd2e0ec6b4c882668c0d35272b2ee4c03c6e.tar.gz rust-6a9dbd2e0ec6b4c882668c0d35272b2ee4c03c6e.zip | |
Only populate local_def_path_hash_to_def_id when needed
| -rw-r--r-- | compiler/rustc_middle/src/ty/query/on_disk_cache.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/rustc_middle/src/ty/query/on_disk_cache.rs b/compiler/rustc_middle/src/ty/query/on_disk_cache.rs index 81dcc2d371d..b2b77b734aa 100644 --- a/compiler/rustc_middle/src/ty/query/on_disk_cache.rs +++ b/compiler/rustc_middle/src/ty/query/on_disk_cache.rs @@ -98,7 +98,10 @@ pub struct OnDiskCache<'sess> { latest_foreign_def_path_hashes: Lock<FxHashMap<DefPathHash, RawDefId>>, // Maps `DefPathHashes` to their corresponding `LocalDefId`s for all - // local items in the current compilation session. + // local items in the current compilation session. This is only populated + // when we are in incremental mode and have loaded a pre-existing cache + // from disk, since this map is only used when deserializing a `DefPathHash` + // from the incremental cache. local_def_path_hash_to_def_id: FxHashMap<DefPathHash, LocalDefId>, // Caches all lookups of `DefPathHashes`, both for local and foreign // definitions. A definition from the previous compilation session @@ -215,7 +218,7 @@ impl<'sess> OnDiskCache<'sess> { } } - pub fn new_empty(source_map: &'sess SourceMap, definitions: &Definitions) -> Self { + pub fn new_empty(source_map: &'sess SourceMap) -> Self { Self { serialized_data: Vec::new(), file_index_to_stable_id: Default::default(), @@ -232,7 +235,7 @@ impl<'sess> OnDiskCache<'sess> { hygiene_context: Default::default(), foreign_def_path_hashes: Default::default(), latest_foreign_def_path_hashes: Default::default(), - local_def_path_hash_to_def_id: make_local_def_path_hash_map(definitions), + local_def_path_hash_to_def_id: Default::default(), def_path_hash_to_def_id_cache: Default::default(), } } |
