diff options
Diffstat (limited to 'compiler/rustc_incremental')
5 files changed, 15 insertions, 30 deletions
diff --git a/compiler/rustc_incremental/src/assert_module_sources.rs b/compiler/rustc_incremental/src/assert_module_sources.rs index 3d9b1c2e741..0111a6d302d 100644 --- a/compiler/rustc_incremental/src/assert_module_sources.rs +++ b/compiler/rustc_incremental/src/assert_module_sources.rs @@ -119,7 +119,7 @@ impl<'tcx> AssertModuleSource<'tcx> { if !self.available_cgus.contains(&cgu_name) { let cgu_names: Vec<&str> = - self.available_cgus.items().map(|cgu| cgu.as_str()).into_sorted_stable_ord(true); + self.available_cgus.items().map(|cgu| cgu.as_str()).into_sorted_stable_ord(); self.tcx.sess.emit_err(errors::NoModuleNamed { span: attr.span, user_path, diff --git a/compiler/rustc_incremental/src/persist/dirty_clean.rs b/compiler/rustc_incremental/src/persist/dirty_clean.rs index 786a0e0d3b2..cbe77e7b16d 100644 --- a/compiler/rustc_incremental/src/persist/dirty_clean.rs +++ b/compiler/rustc_incremental/src/persist/dirty_clean.rs @@ -198,7 +198,7 @@ impl<'tcx> DirtyCleanVisitor<'tcx> { let (name, mut auto) = self.auto_labels(item_id, attr); let except = self.except(attr); let loaded_from_disk = self.loaded_from_disk(attr); - for e in except.items().map(|x| x.as_str()).into_sorted_stable_ord(false) { + for e in except.items().map(|x| x.as_str()).into_sorted_stable_ord() { if !auto.remove(e) { self.tcx.sess.emit_fatal(errors::AssertionAuto { span: attr.span, name, e }); } @@ -377,16 +377,16 @@ impl<'tcx> DirtyCleanVisitor<'tcx> { continue; }; self.checked_attrs.insert(attr.id); - for label in assertion.clean.items().map(|x| x.as_str()).into_sorted_stable_ord(false) { + for label in assertion.clean.items().map(|x| x.as_str()).into_sorted_stable_ord() { let dep_node = DepNode::from_label_string(self.tcx, &label, def_path_hash).unwrap(); self.assert_clean(item_span, dep_node); } - for label in assertion.dirty.items().map(|x| x.as_str()).into_sorted_stable_ord(false) { + for label in assertion.dirty.items().map(|x| x.as_str()).into_sorted_stable_ord() { let dep_node = DepNode::from_label_string(self.tcx, &label, def_path_hash).unwrap(); self.assert_dirty(item_span, dep_node); } for label in - assertion.loaded_from_disk.items().map(|x| x.as_str()).into_sorted_stable_ord(false) + assertion.loaded_from_disk.items().map(|x| x.as_str()).into_sorted_stable_ord() { 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 550772a6881..243057b99bc 100644 --- a/compiler/rustc_incremental/src/persist/fs.rs +++ b/compiler/rustc_incremental/src/persist/fs.rs @@ -676,11 +676,8 @@ 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 - let lock_file_to_session_dir_iter = lock_file_to_session_dir - .items() - .map(|(file, dir)| (file.as_str(), dir.as_ref().map(|y| y.as_str()))); for (lock_file_name, directory_name) in - lock_file_to_session_dir_iter.into_sorted_stable_ord(false) + lock_file_to_session_dir.items().into_sorted_stable_ord() { if directory_name.is_none() { let Ok(timestamp) = extract_timestamp_from_session_dir(lock_file_name) else { @@ -712,10 +709,10 @@ pub fn garbage_collect_session_directories(sess: &Session) -> io::Result<()> { } // Filter out `None` directories - let lock_file_to_session_dir: UnordMap<String, String> = - UnordMap::from(lock_file_to_session_dir.into_items().filter_map( - |(lock_file_name, directory_name)| directory_name.map(|n| (lock_file_name, n)), - )); + let lock_file_to_session_dir: UnordMap<String, String> = lock_file_to_session_dir + .into_items() + .filter_map(|(lock_file_name, directory_name)| directory_name.map(|n| (lock_file_name, n))) + .into(); // Delete all session directories that don't have a lock file. for directory_name in session_directories { @@ -821,7 +818,7 @@ pub fn garbage_collect_session_directories(sess: &Session) -> io::Result<()> { } None }); - let deletion_candidates = UnordMap::from(deletion_candidates); + let deletion_candidates = deletion_candidates.into(); // Delete all but the most recent of the candidates all_except_most_recent(deletion_candidates).into_items().all(|(path, lock)| { diff --git a/compiler/rustc_incremental/src/persist/fs/tests.rs b/compiler/rustc_incremental/src/persist/fs/tests.rs index 4c1cb5725dc..644b8187621 100644 --- a/compiler/rustc_incremental/src/persist/fs/tests.rs +++ b/compiler/rustc_incremental/src/persist/fs/tests.rs @@ -2,23 +2,16 @@ use super::*; #[test] fn test_all_except_most_recent() { - let computed: UnordMap<_, Option<flock::Lock>> = UnordMap::from_iter([ + let input: UnordMap<_, Option<flock::Lock>> = UnordMap::from_iter([ ((UNIX_EPOCH + Duration::new(4, 0), PathBuf::from("4")), None), ((UNIX_EPOCH + Duration::new(1, 0), PathBuf::from("1")), None), ((UNIX_EPOCH + Duration::new(5, 0), PathBuf::from("5")), None), ((UNIX_EPOCH + Duration::new(3, 0), PathBuf::from("3")), None), ((UNIX_EPOCH + Duration::new(2, 0), PathBuf::from("2")), None), ]); - let mut paths = UnordSet::default(); - paths.extend_unord(all_except_most_recent(computed).into_items().map(|(path, _)| path)); assert_eq!( - UnordSet::from(paths), - UnordSet::from_iter([ - PathBuf::from("1"), - PathBuf::from("2"), - PathBuf::from("3"), - PathBuf::from("4") - ]) + all_except_most_recent(input).into_items().map(|(path, _)| path).into_sorted_stable_ord(), + vec![PathBuf::from("1"), PathBuf::from("2"), PathBuf::from("3"), PathBuf::from("4")] ); assert!(all_except_most_recent(UnordMap::default()).is_empty()); diff --git a/compiler/rustc_incremental/src/persist/work_product.rs b/compiler/rustc_incremental/src/persist/work_product.rs index ae604b2ca0b..bce5ca1e16b 100644 --- a/compiler/rustc_incremental/src/persist/work_product.rs +++ b/compiler/rustc_incremental/src/persist/work_product.rs @@ -46,12 +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) { - for path in work_product - .saved_files - .items() - .map(|(_, path)| path.as_str()) - .into_sorted_stable_ord(false) - { + for (_, path) in work_product.saved_files.items().into_sorted_stable_ord() { 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 }); |
