Document snapshot.rs
This commit is contained in:
parent
61a999a531
commit
05cdf8dc3d
2 changed files with 11 additions and 0 deletions
|
@ -133,6 +133,11 @@ pub trait PointerArithmetic: layout::HasDataLayout {
|
|||
impl<T: layout::HasDataLayout> PointerArithmetic for T {}
|
||||
|
||||
|
||||
/// Pointer is generic over the type that represents a reference to Allocations,
|
||||
/// thus making it possible for the most convenient representation to be used in
|
||||
/// each context.
|
||||
///
|
||||
/// Defaults to the index based and loosely coupled AllocId.
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, RustcEncodable, RustcDecodable, Hash)]
|
||||
pub struct Pointer<Id=AllocId> {
|
||||
pub alloc_id: Id,
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
//! This module contains the machinery necessary to detect infinite loops
|
||||
//! during const-evaluation by taking snapshots of the state of the interpreter
|
||||
//! at regular intervals.
|
||||
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
||||
use rustc::ich::{StableHashingContext, StableHashingContextProvider};
|
||||
|
@ -89,6 +93,8 @@ trait SnapshotContext<'a> {
|
|||
fn resolve(&'a self, id: &AllocId) -> Option<&'a Allocation>;
|
||||
}
|
||||
|
||||
/// Taking a snapshot of the evaluation context produces a view of
|
||||
/// the state of the interpreter that is invariant to `AllocId`s.
|
||||
trait Snapshot<'a, Ctx: SnapshotContext<'a>> {
|
||||
type Item;
|
||||
fn snapshot(&self, ctx: &'a Ctx) -> Self::Item;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue