]> git.lizzy.rs Git - rust.git/commitdiff
Avoid deconstructing pointer for hashing
authorMark Rousskov <mark.simulacrum@gmail.com>
Fri, 3 Jul 2020 11:40:37 +0000 (07:40 -0400)
committerMark Rousskov <mark.simulacrum@gmail.com>
Sun, 5 Jul 2020 13:51:42 +0000 (09:51 -0400)
src/librustc_middle/ty/mod.rs

index fde99f5c2709fb010e08bee0195f06d00ede0012..ffb41b094dcd5adeb3e149c823ff596d9ca96592 100644 (file)
@@ -1621,8 +1621,9 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 
 impl<'tcx> Hash for ParamEnv<'tcx> {
     fn hash<H: Hasher>(&self, state: &mut H) {
-        self.caller_bounds().hash(state);
-        self.reveal().hash(state);
+        // List hashes as the raw pointer, so we can skip splitting into the
+        // pointer and the enum.
+        self.packed_data.hash(state);
         self.def_id.hash(state);
     }
 }