diff options
| author | bors <bors@rust-lang.org> | 2023-06-08 07:30:03 +0000 | 
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-06-08 07:30:03 +0000 | 
| commit | a0df04c0f2b9c0415c53e3cee8c4f9fa394a37b2 (patch) | |
| tree | 0be6a55d83be0af20c6a73a5b7981cad8483d5f1 /compiler/rustc_interface/src | |
| parent | 80917360d350fb55aebf383e7ff99efea41f63fd (diff) | |
| parent | 3f324a8b7d62f44f97ba76eeb76b67d6ff0bf744 (diff) | |
| download | rust-a0df04c0f2b9c0415c53e3cee8c4f9fa394a37b2.tar.gz rust-a0df04c0f2b9c0415c53e3cee8c4f9fa394a37b2.zip | |
Auto merge of #110040 - ndrewxie:issue-84447-partial-1, r=lcnr,michaelwoerister
Removed use of iteration through a HashMap/HashSet in rustc_incremental and replaced with IndexMap/IndexSet This allows for the `#[allow(rustc::potential_query_instability)]` in rustc_incremental to be removed, moving towards fixing #84447 (although a LOT more modules have to be changed to fully resolve it). Only HashMaps/HashSets that are being iterated through have been modified (although many structs and traits outside of rustc_incremental had to be modified as well, as they had fields/methods that involved a HashMap/HashSet that would be iterated through) I'm making a PR for just 1 module changed to test for performance regressions and such, for future changes I'll either edit this PR to reflect additional modules being converted, or batch multiple modules of changes together and make a PR for each group of modules.
Diffstat (limited to 'compiler/rustc_interface/src')
| -rw-r--r-- | compiler/rustc_interface/src/queries.rs | 11 | 
1 files changed, 9 insertions, 2 deletions
| diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs index c441a8ffd6f..455a8129656 100644 --- a/compiler/rustc_interface/src/queries.rs +++ b/compiler/rustc_interface/src/queries.rs @@ -5,6 +5,7 @@ use crate::passes; use rustc_ast as ast; use rustc_codegen_ssa::traits::CodegenBackend; use rustc_codegen_ssa::CodegenResults; +use rustc_data_structures::fx::FxIndexMap; use rustc_data_structures::steal::Steal; use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::{AppendOnlyIndexVec, Lrc, OnceCell, RwLock, WorkerLocal}; @@ -193,9 +194,15 @@ impl<'tcx> Queries<'tcx> { let future_opt = self.dep_graph_future()?.steal(); let dep_graph = future_opt .and_then(|future| { - let (prev_graph, prev_work_products) = + let (prev_graph, mut prev_work_products) = sess.time("blocked_on_dep_graph_loading", || future.open().open(sess)); - + // Convert from UnordMap to FxIndexMap by sorting + let prev_work_product_ids = + prev_work_products.items().map(|x| *x.0).into_sorted_stable_ord(); + let prev_work_products = prev_work_product_ids + .into_iter() + .map(|x| (x, prev_work_products.remove(&x).unwrap())) + .collect::<FxIndexMap<_, _>>(); rustc_incremental::build_dep_graph(sess, prev_graph, prev_work_products) }) .unwrap_or_else(DepGraph::new_disabled); | 
