about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTyson Nottingham <tgnottingham@gmail.com>2020-12-18 18:40:16 -0800
committerTyson Nottingham <tgnottingham@gmail.com>2020-12-18 18:54:55 -0800
commit55ae3b3a79a44f154334fed077c511b17aef9913 (patch)
tree6a60c7967b7d703e2687da316c95c7df7afcd8bc
parent779580190209cab277facdd8f98c2b16a049762f (diff)
downloadrust-55ae3b3a79a44f154334fed077c511b17aef9913.tar.gz
rust-55ae3b3a79a44f154334fed077c511b17aef9913.zip
OnDiskCache: avoid storing local def id hashes in foreign def id collection
-rw-r--r--compiler/rustc_middle/src/ty/query/on_disk_cache.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_middle/src/ty/query/on_disk_cache.rs b/compiler/rustc_middle/src/ty/query/on_disk_cache.rs
index 8316b4c109b..f6aaeecd6e3 100644
--- a/compiler/rustc_middle/src/ty/query/on_disk_cache.rs
+++ b/compiler/rustc_middle/src/ty/query/on_disk_cache.rs
@@ -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,
@@ -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);
+                }
             }
         }
     }