]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/ty/util.rs
Merge remote-tracking branch 'origin/master' into gen
[rust.git] / src / librustc / ty / util.rs
index 2d29a288a260831e780c4eb7b4d1d9a0c37e6463..82810b7aae1bb1a70b93af6f6c5399ed8c6929be 100644 (file)
@@ -215,6 +215,11 @@ pub fn type_id_hash(self, ty: Ty<'tcx>) -> u64 {
         let mut hasher = StableHasher::new();
         let mut hcx = StableHashingContext::new(self);
 
+        // We want the type_id be independent of the types free regions, so we
+        // erase them. The erase_regions() call will also anonymize bound
+        // regions, which is desirable too.
+        let ty = self.erase_regions(&ty);
+
         hcx.while_hashing_spans(false, |hcx| {
             hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
                 ty.hash_stable(hcx, &mut hasher);