From 6f2d3dee1790f8066394d1198fd1864b5fae45a3 Mon Sep 17 00:00:00 2001 From: Andrew Xie Date: Mon, 8 May 2023 17:26:17 -0400 Subject: [PATCH] Fixed unord mistake --- compiler/rustc_data_structures/src/unord.rs | 5 --- .../src/persist/dirty_clean.rs | 6 ++-- compiler/rustc_incremental/src/persist/fs.rs | 36 ++++++++++--------- .../src/persist/work_product.rs | 2 +- 4 files changed, 23 insertions(+), 26 deletions(-) diff --git a/compiler/rustc_data_structures/src/unord.rs b/compiler/rustc_data_structures/src/unord.rs index 02957b38efe..6c8d5414631 100644 --- a/compiler/rustc_data_structures/src/unord.rs +++ b/compiler/rustc_data_structures/src/unord.rs @@ -62,11 +62,6 @@ impl> UnordItems { UnordItems(self.0.filter_map(f)) } - #[inline] - pub fn for_each ()>(self, f: F) { - self.0.for_each(|x| f(x)); - } - #[inline] pub fn max(self) -> Option where diff --git a/compiler/rustc_incremental/src/persist/dirty_clean.rs b/compiler/rustc_incremental/src/persist/dirty_clean.rs index b7bdffe5b06..6381a05dfdc 100644 --- a/compiler/rustc_incremental/src/persist/dirty_clean.rs +++ b/compiler/rustc_incremental/src/persist/dirty_clean.rs @@ -377,15 +377,15 @@ impl<'tcx> DirtyCleanVisitor<'tcx> { continue; }; self.checked_attrs.insert(attr.id); - assertion.clean.items().for_each(|label| { + assertion.clean.to_sorted(&(), false).iter().for_each(|label| { let dep_node = DepNode::from_label_string(self.tcx, &label, def_path_hash).unwrap(); self.assert_clean(item_span, dep_node); }); - assertion.dirty.items().for_each(|label| { + assertion.dirty.to_sorted(&(), false).iter().for_each(|label| { let dep_node = DepNode::from_label_string(self.tcx, &label, def_path_hash).unwrap(); self.assert_dirty(item_span, dep_node); }); - assertion.loaded_from_disk.items().for_each(|label| { + assertion.loaded_from_disk.to_sorted(&(), false).iter().for_each(|label| { let dep_node = DepNode::from_label_string(self.tcx, &label, def_path_hash).unwrap(); self.assert_loaded_from_disk(item_span, dep_node); }); diff --git a/compiler/rustc_incremental/src/persist/fs.rs b/compiler/rustc_incremental/src/persist/fs.rs index c3f1abadace..f0e5f07230f 100644 --- a/compiler/rustc_incremental/src/persist/fs.rs +++ b/compiler/rustc_incremental/src/persist/fs.rs @@ -674,9 +674,10 @@ pub fn garbage_collect_session_directories(sess: &Session) -> io::Result<()> { // Delete all lock files, that don't have an associated directory. They must // be some kind of leftover - lock_file_to_session_dir.items().for_each(|(lock_file_name, directory_name)| { - if directory_name.is_none() { - let Ok(timestamp) = extract_timestamp_from_session_dir(lock_file_name) else { + lock_file_to_session_dir.to_sorted(&(), false).iter().for_each( + |(lock_file_name, directory_name)| { + if directory_name.is_none() { + let Ok(timestamp) = extract_timestamp_from_session_dir(lock_file_name) else { debug!( "found lock-file with malformed timestamp: {}", crate_directory.join(&lock_file_name).display() @@ -685,24 +686,25 @@ pub fn garbage_collect_session_directories(sess: &Session) -> io::Result<()> { return; }; - let lock_file_path = crate_directory.join(&**lock_file_name); + let lock_file_path = crate_directory.join(&**lock_file_name); - if is_old_enough_to_be_collected(timestamp) { - debug!( - "garbage_collect_session_directories() - deleting \ + if is_old_enough_to_be_collected(timestamp) { + debug!( + "garbage_collect_session_directories() - deleting \ garbage lock file: {}", - lock_file_path.display() - ); - delete_session_dir_lock_file(sess, &lock_file_path); - } else { - debug!( - "garbage_collect_session_directories() - lock file with \ + lock_file_path.display() + ); + delete_session_dir_lock_file(sess, &lock_file_path); + } else { + debug!( + "garbage_collect_session_directories() - lock file with \ no session dir not old enough to be collected: {}", - lock_file_path.display() - ); + lock_file_path.display() + ); + } } - } - }); + }, + ); // Filter out `None` directories let lock_file_to_session_dir: UnordMap = diff --git a/compiler/rustc_incremental/src/persist/work_product.rs b/compiler/rustc_incremental/src/persist/work_product.rs index 865f90273bd..b0d173ab304 100644 --- a/compiler/rustc_incremental/src/persist/work_product.rs +++ b/compiler/rustc_incremental/src/persist/work_product.rs @@ -46,7 +46,7 @@ pub fn copy_cgu_workproduct_to_incr_comp_cache_dir( /// Removes files for a given work product. pub fn delete_workproduct_files(sess: &Session, work_product: &WorkProduct) { - work_product.saved_files.items().for_each(|(_, path)| { + work_product.saved_files.to_sorted(&(), false).iter().for_each(|(_, path)| { let path = in_incr_comp_dir_sess(sess, path); if let Err(err) = std_fs::remove_file(&path) { sess.emit_warning(errors::DeleteWorkProduct { path: &path, err });