about summary refs log tree commit diff
path: root/compiler/rustc_incremental
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2023-08-13 16:07:41 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2023-08-13 16:07:48 +0000
commit980143b50c627fc36ef15a2dc25f44f33cbd6bac (patch)
tree63d8762f15b5c20cd32f93605823f8150f8b8d90 /compiler/rustc_incremental
parent4a6de8e0dd6d6bf805160fca11ed661c00a5c310 (diff)
downloadrust-980143b50c627fc36ef15a2dc25f44f33cbd6bac.tar.gz
rust-980143b50c627fc36ef15a2dc25f44f33cbd6bac.zip
Pass WorkProductMap to build_dep_graph instead of FxIndexMap
Constructing an FxIndexMap is useless work as the iteration order never
matters.
Diffstat (limited to 'compiler/rustc_incremental')
-rw-r--r--compiler/rustc_incremental/src/persist/load.rs4
-rw-r--r--compiler/rustc_incremental/src/persist/save.rs8
2 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_incremental/src/persist/load.rs b/compiler/rustc_incremental/src/persist/load.rs
index bb479b5bdcc..8d67f692568 100644
--- a/compiler/rustc_incremental/src/persist/load.rs
+++ b/compiler/rustc_incremental/src/persist/load.rs
@@ -3,7 +3,7 @@
 use crate::errors;
 use rustc_data_structures::memmap::Mmap;
 use rustc_data_structures::unord::UnordMap;
-use rustc_middle::dep_graph::{SerializedDepGraph, WorkProduct, WorkProductId};
+use rustc_middle::dep_graph::{SerializedDepGraph, WorkProductMap};
 use rustc_middle::query::on_disk_cache::OnDiskCache;
 use rustc_serialize::opaque::MemDecoder;
 use rustc_serialize::Decodable;
@@ -16,8 +16,6 @@ use super::file_format;
 use super::fs::*;
 use super::work_product;
 
-type WorkProductMap = UnordMap<WorkProductId, WorkProduct>;
-
 #[derive(Debug)]
 /// Represents the result of an attempt to load incremental compilation data.
 pub enum LoadResult<T> {
diff --git a/compiler/rustc_incremental/src/persist/save.rs b/compiler/rustc_incremental/src/persist/save.rs
index bfaa52f9c81..0cfaf583774 100644
--- a/compiler/rustc_incremental/src/persist/save.rs
+++ b/compiler/rustc_incremental/src/persist/save.rs
@@ -1,7 +1,9 @@
 use crate::errors;
 use rustc_data_structures::fx::FxIndexMap;
 use rustc_data_structures::sync::join;
-use rustc_middle::dep_graph::{DepGraph, SerializedDepGraph, WorkProduct, WorkProductId};
+use rustc_middle::dep_graph::{
+    DepGraph, SerializedDepGraph, WorkProduct, WorkProductId, WorkProductMap,
+};
 use rustc_middle::ty::TyCtxt;
 use rustc_serialize::opaque::{FileEncodeResult, FileEncoder};
 use rustc_serialize::Encodable as RustcEncodable;
@@ -101,7 +103,7 @@ pub fn save_work_product_index(
     // deleted during invalidation. Some object files don't change their
     // content, they are just not needed anymore.
     let previous_work_products = dep_graph.previous_work_products();
-    for (id, wp) in previous_work_products.iter() {
+    for (id, wp) in previous_work_products.to_sorted_stable_ord().iter() {
         if !new_work_products.contains_key(id) {
             work_product::delete_workproduct_files(sess, wp);
             debug_assert!(
@@ -146,7 +148,7 @@ fn encode_query_cache(tcx: TyCtxt<'_>, encoder: FileEncoder) -> FileEncodeResult
 pub fn build_dep_graph(
     sess: &Session,
     prev_graph: SerializedDepGraph,
-    prev_work_products: FxIndexMap<WorkProductId, WorkProduct>,
+    prev_work_products: WorkProductMap,
 ) -> Option<DepGraph> {
     if sess.opts.incremental.is_none() {
         // No incremental compilation.