about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMichael Woerister <michaelwoerister@posteo.net>2016-09-13 08:45:34 -0400
committerMichael Woerister <michaelwoerister@posteo.net>2016-09-13 15:22:51 -0400
commit75a0dd0fca4e3e3b5eade66fb3dddc2b9868dc52 (patch)
tree7aafe37a34b3634bfe68889e660e855352b5cf9c /src
parent94d75013bcf6fc8e79cd7c0c76c37e68c458db6f (diff)
downloadrust-75a0dd0fca4e3e3b5eade66fb3dddc2b9868dc52.tar.gz
rust-75a0dd0fca4e3e3b5eade66fb3dddc2b9868dc52.zip
Make TypeIdHasher use DefPath::deterministic_hash() for stability.
Diffstat (limited to 'src')
-rw-r--r--src/librustc/ty/util.rs14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs
index c6020838b53..a8287ecc046 100644
--- a/src/librustc/ty/util.rs
+++ b/src/librustc/ty/util.rs
@@ -411,15 +411,11 @@ impl<'a, 'gcx, 'tcx> TypeIdHasher<'a, 'gcx, 'tcx> {
     }
 
     fn def_id(&mut self, did: DefId) {
-        // Hash the crate identification information.
-        let name = self.tcx.crate_name(did.krate);
-        let disambiguator = self.tcx.crate_disambiguator(did.krate);
-        self.hash((name, disambiguator));
-
-        // Hash the item path within that crate.
-        // FIXME(#35379) This should use a deterministic
-        // DefPath hashing mechanism, not the DefIndex.
-        self.hash(did.index);
+        // Hash the DefPath corresponding to the DefId, which is independent
+        // of compiler internal state.
+        let tcx = self.tcx;
+        let def_path = tcx.def_path(did);
+        def_path.deterministic_hash_to(tcx, &mut self.state);
     }
 }