Fixed unord mistake

This commit is contained in:
Andrew Xie 2023-05-08 17:26:17 -04:00
parent 96b577860d
commit 6f2d3dee17
4 changed files with 23 additions and 26 deletions

View File

@ -62,11 +62,6 @@ impl<T, I: Iterator<Item = T>> UnordItems<T, I> {
UnordItems(self.0.filter_map(f)) UnordItems(self.0.filter_map(f))
} }
#[inline]
pub fn for_each<F: Fn(T) -> ()>(self, f: F) {
self.0.for_each(|x| f(x));
}
#[inline] #[inline]
pub fn max(self) -> Option<T> pub fn max(self) -> Option<T>
where where

View File

@ -377,15 +377,15 @@ impl<'tcx> DirtyCleanVisitor<'tcx> {
continue; continue;
}; };
self.checked_attrs.insert(attr.id); 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(); let dep_node = DepNode::from_label_string(self.tcx, &label, def_path_hash).unwrap();
self.assert_clean(item_span, dep_node); 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(); let dep_node = DepNode::from_label_string(self.tcx, &label, def_path_hash).unwrap();
self.assert_dirty(item_span, dep_node); 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(); let dep_node = DepNode::from_label_string(self.tcx, &label, def_path_hash).unwrap();
self.assert_loaded_from_disk(item_span, dep_node); self.assert_loaded_from_disk(item_span, dep_node);
}); });

View File

@ -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 // Delete all lock files, that don't have an associated directory. They must
// be some kind of leftover // be some kind of leftover
lock_file_to_session_dir.items().for_each(|(lock_file_name, directory_name)| { lock_file_to_session_dir.to_sorted(&(), false).iter().for_each(
if directory_name.is_none() { |(lock_file_name, directory_name)| {
let Ok(timestamp) = extract_timestamp_from_session_dir(lock_file_name) else { if directory_name.is_none() {
let Ok(timestamp) = extract_timestamp_from_session_dir(lock_file_name) else {
debug!( debug!(
"found lock-file with malformed timestamp: {}", "found lock-file with malformed timestamp: {}",
crate_directory.join(&lock_file_name).display() crate_directory.join(&lock_file_name).display()
@ -685,24 +686,25 @@ pub fn garbage_collect_session_directories(sess: &Session) -> io::Result<()> {
return; 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) { if is_old_enough_to_be_collected(timestamp) {
debug!( debug!(
"garbage_collect_session_directories() - deleting \ "garbage_collect_session_directories() - deleting \
garbage lock file: {}", garbage lock file: {}",
lock_file_path.display() lock_file_path.display()
); );
delete_session_dir_lock_file(sess, &lock_file_path); delete_session_dir_lock_file(sess, &lock_file_path);
} else { } else {
debug!( debug!(
"garbage_collect_session_directories() - lock file with \ "garbage_collect_session_directories() - lock file with \
no session dir not old enough to be collected: {}", no session dir not old enough to be collected: {}",
lock_file_path.display() lock_file_path.display()
); );
}
} }
} },
}); );
// Filter out `None` directories // Filter out `None` directories
let lock_file_to_session_dir: UnordMap<String, String> = let lock_file_to_session_dir: UnordMap<String, String> =

View File

@ -46,7 +46,7 @@ pub fn copy_cgu_workproduct_to_incr_comp_cache_dir(
/// Removes files for a given work product. /// Removes files for a given work product.
pub fn delete_workproduct_files(sess: &Session, work_product: &WorkProduct) { 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); let path = in_incr_comp_dir_sess(sess, path);
if let Err(err) = std_fs::remove_file(&path) { if let Err(err) = std_fs::remove_file(&path) {
sess.emit_warning(errors::DeleteWorkProduct { path: &path, err }); sess.emit_warning(errors::DeleteWorkProduct { path: &path, err });