Skip to content

Commit bf6ba97

Browse files
committed
Impl SnapshotContext for Memory
1 parent adb1965 commit bf6ba97

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/librustc_mir/interpret/snapshot.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,16 @@ struct MemorySnapshot<'a, 'mir: 'a, 'tcx: 'a + 'mir, M: Machine<'mir, 'tcx> + 'a
269269
data: &'a M::MemoryData,
270270
}
271271

272+
impl<'a, 'b, 'mir, 'tcx, M> SnapshotContext<'b> for Memory<'a, 'mir, 'tcx, M>
273+
where M: Machine<'mir, 'tcx>,
274+
{
275+
type To = Allocation;
276+
type From = AllocId;
277+
fn resolve(&'b self, id: &Self::From) -> Option<&'b Self::To> {
278+
self.get(*id).ok()
279+
}
280+
}
281+
272282
/// The virtual machine state during const-evaluation at a given point in time.
273283
#[derive(Eq, PartialEq)]
274284
pub struct EvalSnapshot<'a, 'mir, 'tcx: 'a + 'mir, M: Machine<'mir, 'tcx>> {

0 commit comments

Comments
 (0)