diff options
| author | Bruno Dutra <brunocodutra@gmail.com> | 2018-08-18 12:32:37 +0200 |
|---|---|---|
| committer | Bruno Dutra <brunocodutra@gmail.com> | 2018-09-03 20:02:35 +0200 |
| commit | bf6ba974dede851b59afb9aa031ce0c548b754c4 (patch) | |
| tree | 4a92de008245d1c3d8f5bbeb18e473f9e118695f | |
| parent | adb1965c12587bcc24edd62e9ecf1c240f8196cd (diff) | |
| download | rust-bf6ba974dede851b59afb9aa031ce0c548b754c4.tar.gz rust-bf6ba974dede851b59afb9aa031ce0c548b754c4.zip | |
Impl SnapshotContext for Memory
| -rw-r--r-- | src/librustc_mir/interpret/snapshot.rs | 10 |
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>> { |
