about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2019-11-22 19:23:08 +0100
committerCamille GILLOT <gillot.camille@gmail.com>2019-11-22 19:23:08 +0100
commit3e969e070fcb0d8fab5d2c812edad12490fe8c1d (patch)
treefcfc5afe3013b39cf1ba1fcc0dd9469874c9cb39
parent083b5a0a1bb3b2ee0873697ebf37e88d85faa3e5 (diff)
downloadrust-3e969e070fcb0d8fab5d2c812edad12490fe8c1d.tar.gz
rust-3e969e070fcb0d8fab5d2c812edad12490fe8c1d.zip
Revert "Revert expansion of impl HashStable for Frame."
This reverts commit 579625b9e738e606b91fa315c75ab4909fa090be.
-rw-r--r--src/librustc_mir/interpret/eval_context.rs20
-rw-r--r--src/librustc_mir/interpret/snapshot.rs12
2 files changed, 20 insertions, 12 deletions
diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs
index 08640476f7a..471227f7403 100644
--- a/src/librustc_mir/interpret/eval_context.rs
+++ b/src/librustc_mir/interpret/eval_context.rs
@@ -3,6 +3,7 @@ use std::fmt::Write;
 use std::mem;
 
 use syntax::source_map::{self, Span, DUMMY_SP};
+use rustc::ich::StableHashingContext;
 use rustc::hir::def_id::DefId;
 use rustc::hir::def::DefKind;
 use rustc::mir;
@@ -18,6 +19,7 @@ use rustc::mir::interpret::{
     InterpResult, truncate, sign_extend,
 };
 use rustc_data_structures::fx::FxHashMap;
+use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
 use rustc_macros::HashStable;
 
 use super::{
@@ -829,3 +831,21 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
         frames
     }
 }
+
+impl<'ctx, 'mir, 'tcx, Tag, Extra> HashStable<StableHashingContext<'ctx>>
+for Frame<'mir, 'tcx, Tag, Extra>
+    where Extra: HashStable<StableHashingContext<'ctx>>,
+          Tag:   HashStable<StableHashingContext<'ctx>>
+{
+    fn hash_stable(&self, hcx: &mut StableHashingContext<'ctx>, hasher: &mut StableHasher) {
+        self.body.hash_stable(hcx, hasher);
+        self.instance.hash_stable(hcx, hasher);
+        self.span.hash_stable(hcx, hasher);
+        self.return_to_block.hash_stable(hcx, hasher);
+        self.return_place.as_ref().map(|r| &**r).hash_stable(hcx, hasher);
+        self.locals.hash_stable(hcx, hasher);
+        self.block.hash_stable(hcx, hasher);
+        self.stmt.hash_stable(hcx, hasher);
+        self.extra.hash_stable(hcx, hasher);
+    }
+}
diff --git a/src/librustc_mir/interpret/snapshot.rs b/src/librustc_mir/interpret/snapshot.rs
index b460badd1fd..3ea00d69221 100644
--- a/src/librustc_mir/interpret/snapshot.rs
+++ b/src/librustc_mir/interpret/snapshot.rs
@@ -304,18 +304,6 @@ struct FrameSnapshot<'a, 'tcx> {
     stmt: usize,
 }
 
-impl_stable_hash_for!(impl<> for struct Frame<'mir, 'tcx> {
-    body,
-    instance,
-    span,
-    return_to_block,
-    return_place -> (return_place.as_ref().map(|r| &**r)),
-    locals,
-    block,
-    stmt,
-    extra,
-});
-
 impl<'a, 'mir, 'tcx, Ctx> Snapshot<'a, Ctx> for &'a Frame<'mir, 'tcx>
     where Ctx: SnapshotContext<'a>,
 {