Skip to content

Commit

Permalink
OnDiskCache: avoid storing local def id hashes in foreign def id coll…
Browse files Browse the repository at this point in the history
…ection
  • Loading branch information
tgnottingham committed Dec 19, 2020
1 parent 7795801 commit 55ae3b3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions compiler/rustc_middle/src/ty/query/on_disk_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ impl<'sess> OnDiskCache<'sess> {
}

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

0 comments on commit 55ae3b3

Please sign in to comment.