Fixed to_sorted => to_sorted_stable_ord
This commit is contained in:
parent
6f2d3dee17
commit
f5f638c124
@ -339,6 +339,8 @@ fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl<T1: StableOrd, T2: StableOrd> StableOrd for (T1, T2) {}
|
||||
|
||||
impl<T1, T2, T3, CTX> HashStable<CTX> for (T1, T2, T3)
|
||||
where
|
||||
T1: HashStable<CTX>,
|
||||
@ -353,6 +355,8 @@ fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl<T1: StableOrd, T2: StableOrd, T3: StableOrd> StableOrd for (T1, T2, T3) {}
|
||||
|
||||
impl<T1, T2, T3, T4, CTX> HashStable<CTX> for (T1, T2, T3, T4)
|
||||
where
|
||||
T1: HashStable<CTX>,
|
||||
@ -369,6 +373,11 @@ fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl<T1: StableOrd, T2: StableOrd, T3: StableOrd, T4: StableOrd> StableOrd
|
||||
for (T1, T2, T3, T4)
|
||||
{
|
||||
}
|
||||
|
||||
impl<T: HashStable<CTX>, CTX> HashStable<CTX> for [T] {
|
||||
default fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
|
||||
self.len().hash_stable(ctx, hasher);
|
||||
@ -459,6 +468,8 @@ fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl StableOrd for &str {}
|
||||
|
||||
impl<CTX> HashStable<CTX> for String {
|
||||
#[inline]
|
||||
fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher) {
|
||||
|
@ -118,8 +118,8 @@ fn check_attr(&self, attr: &ast::Attribute) {
|
||||
debug!("mapping '{}' to cgu name '{}'", self.field(attr, sym::module), cgu_name);
|
||||
|
||||
if !self.available_cgus.contains(&cgu_name) {
|
||||
let cgu_names: Vec<String> =
|
||||
self.available_cgus.items().map(|cgu| cgu.as_str().to_owned()).into_sorted(&());
|
||||
let cgu_names: Vec<&str> =
|
||||
self.available_cgus.items().map(|cgu| cgu.as_str()).into_sorted_stable_ord(true);
|
||||
self.tcx.sess.emit_err(errors::NoModuleNamed {
|
||||
span: attr.span,
|
||||
user_path,
|
||||
|
@ -198,7 +198,7 @@ fn assertion_auto(&mut self, item_id: LocalDefId, attr: &Attribute) -> Assertion
|
||||
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.to_sorted(&(), false) {
|
||||
for e in except.items().map(|x| x.as_str()).into_sorted_stable_ord(false) {
|
||||
if !auto.remove(e) {
|
||||
self.tcx.sess.emit_fatal(errors::AssertionAuto { span: attr.span, name, e });
|
||||
}
|
||||
@ -377,18 +377,20 @@ fn check_item(&mut self, item_id: LocalDefId) {
|
||||
continue;
|
||||
};
|
||||
self.checked_attrs.insert(attr.id);
|
||||
assertion.clean.to_sorted(&(), false).iter().for_each(|label| {
|
||||
for label in assertion.clean.items().map(|x| x.as_str()).into_sorted_stable_ord(false) {
|
||||
let dep_node = DepNode::from_label_string(self.tcx, &label, def_path_hash).unwrap();
|
||||
self.assert_clean(item_span, dep_node);
|
||||
});
|
||||
assertion.dirty.to_sorted(&(), false).iter().for_each(|label| {
|
||||
}
|
||||
for label in assertion.dirty.items().map(|x| x.as_str()).into_sorted_stable_ord(false) {
|
||||
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.to_sorted(&(), false).iter().for_each(|label| {
|
||||
}
|
||||
for label in
|
||||
assertion.loaded_from_disk.items().map(|x| x.as_str()).into_sorted_stable_ord(false)
|
||||
{
|
||||
let dep_node = DepNode::from_label_string(self.tcx, &label, def_path_hash).unwrap();
|
||||
self.assert_loaded_from_disk(item_span, dep_node);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -661,8 +661,9 @@ pub fn garbage_collect_session_directories(sess: &Session) -> io::Result<()> {
|
||||
session_directories.sort();
|
||||
|
||||
// Now map from lock files to session directories
|
||||
let lock_file_to_session_dir: UnordMap<String, Option<String>> =
|
||||
UnordMap::from(lock_files.into_items().map(|lock_file_name| {
|
||||
let lock_file_to_session_dir: UnordMap<String, Option<String>> = lock_files
|
||||
.into_items()
|
||||
.map(|lock_file_name| {
|
||||
assert!(lock_file_name.ends_with(LOCK_FILE_EXT));
|
||||
let dir_prefix_end = lock_file_name.len() - LOCK_FILE_EXT.len();
|
||||
let session_dir = {
|
||||
@ -670,41 +671,45 @@ pub fn garbage_collect_session_directories(sess: &Session) -> io::Result<()> {
|
||||
session_directories.iter().find(|dir_name| dir_name.starts_with(dir_prefix))
|
||||
};
|
||||
(lock_file_name, session_dir.map(String::clone))
|
||||
}));
|
||||
})
|
||||
.into();
|
||||
|
||||
// Delete all lock files, that don't have an associated directory. They must
|
||||
// be some kind of leftover
|
||||
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 {
|
||||
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)
|
||||
{
|
||||
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()
|
||||
);
|
||||
// Ignore it
|
||||
return;
|
||||
continue;
|
||||
};
|
||||
|
||||
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 \
|
||||
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 \
|
||||
no session dir not old enough to be collected: {}",
|
||||
lock_file_path.display()
|
||||
);
|
||||
}
|
||||
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 \
|
||||
no session dir not old enough to be collected: {}",
|
||||
lock_file_path.display()
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Filter out `None` directories
|
||||
let lock_file_to_session_dir: UnordMap<String, String> =
|
||||
|
@ -147,7 +147,7 @@ pub fn load_dep_graph(sess: &Session) -> DepGraphFuture {
|
||||
let report_incremental_info = sess.opts.unstable_opts.incremental_info;
|
||||
let expected_hash = sess.opts.dep_tracking_hash(false);
|
||||
|
||||
let mut prev_work_products = FxIndexMap::default();
|
||||
let mut prev_work_products = UnordMap::default();
|
||||
|
||||
// If we are only building with -Zquery-dep-graph but without an actual
|
||||
// incr. comp. session directory, we skip this. Otherwise we'd fail
|
||||
|
@ -46,10 +46,15 @@ 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.to_sorted(&(), false).iter().for_each(|(_, path)| {
|
||||
for path in work_product
|
||||
.saved_files
|
||||
.items()
|
||||
.map(|(_, path)| path.as_str())
|
||||
.into_sorted_stable_ord(false)
|
||||
{
|
||||
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 });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user