Skip to content

Commit 55ae3b3

Browse files
committed
OnDiskCache: avoid storing local def id hashes in foreign def id collection
1 parent 7795801 commit 55ae3b3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

compiler/rustc_middle/src/ty/query/on_disk_cache.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ impl<'sess> OnDiskCache<'sess> {
475475
}
476476

477477
/// If the given `dep_node`'s hash still exists in the current compilation,
478-
/// calls `store_foreign_def_id` with its current `DefId`.
478+
/// and its current `DefId` is foreign, calls `store_foreign_def_id` with it.
479479
///
480480
/// Normally, `store_foreign_def_id_hash` can be called directly by
481481
/// the dependency graph when we construct a `DepNode`. However,
@@ -497,7 +497,9 @@ impl<'sess> OnDiskCache<'sess> {
497497
// changed in the current compilation session (e.g. we've added/removed crates,
498498
// or added/removed definitions before/after the target definition).
499499
if let Some(def_id) = self.def_path_hash_to_def_id(tcx, hash) {
500-
self.store_foreign_def_id_hash(def_id, hash);
500+
if !def_id.is_local() {
501+
self.store_foreign_def_id_hash(def_id, hash);
502+
}
501503
}
502504
}
503505
}

0 commit comments

Comments
 (0)