about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc_mir/interpret/snapshot.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/librustc_mir/interpret/snapshot.rs b/src/librustc_mir/interpret/snapshot.rs
index 2bb184cd9bc..d23122825aa 100644
--- a/src/librustc_mir/interpret/snapshot.rs
+++ b/src/librustc_mir/interpret/snapshot.rs
@@ -269,6 +269,16 @@ struct MemorySnapshot<'a, 'mir: 'a, 'tcx: 'a + 'mir, M: Machine<'mir, 'tcx> + 'a
     data: &'a M::MemoryData,
 }
 
+impl<'a, 'b, 'mir, 'tcx, M> SnapshotContext<'b> for Memory<'a, 'mir, 'tcx, M>
+    where M: Machine<'mir, 'tcx>,
+{
+    type To = Allocation;
+    type From = AllocId;
+    fn resolve(&'b self, id: &Self::From) -> Option<&'b Self::To> {
+        self.get(*id).ok()
+    }
+}
+
 /// The virtual machine state during const-evaluation at a given point in time.
 #[derive(Eq, PartialEq)]
 pub struct EvalSnapshot<'a, 'mir, 'tcx: 'a + 'mir, M: Machine<'mir, 'tcx>> {