Skip to content

Commit 3aca71f

Browse files
committed
rename EvalSnapshot -> InterpSnapshot
1 parent d324205 commit 3aca71f

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/librustc_mir/interpret/snapshot.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@ use crate::const_eval::CompileTimeInterpreter;
2929

3030
#[derive(Default)]
3131
pub(crate) struct InfiniteLoopDetector<'a, 'mir, 'tcx: 'a + 'mir> {
32-
/// The set of all `EvalSnapshot` *hashes* observed by this detector.
32+
/// The set of all `InterpSnapshot` *hashes* observed by this detector.
3333
///
3434
/// When a collision occurs in this table, we store the full snapshot in
3535
/// `snapshots`.
3636
hashes: FxHashSet<u64>,
3737

38-
/// The set of all `EvalSnapshot`s observed by this detector.
38+
/// The set of all `InterpSnapshot`s observed by this detector.
3939
///
40-
/// An `EvalSnapshot` will only be fully cloned once it has caused a
40+
/// An `InterpSnapshot` will only be fully cloned once it has caused a
4141
/// collision in `hashes`. As a result, the detector must observe at least
4242
/// *two* full cycles of an infinite loop before it triggers.
43-
snapshots: FxHashSet<EvalSnapshot<'a, 'mir, 'tcx>>,
43+
snapshots: FxHashSet<InterpSnapshot<'a, 'mir, 'tcx>>,
4444
}
4545

4646
impl<'a, 'mir, 'tcx> InfiniteLoopDetector<'a, 'mir, 'tcx>
@@ -72,7 +72,7 @@ impl<'a, 'mir, 'tcx> InfiniteLoopDetector<'a, 'mir, 'tcx>
7272
// We need to make a full copy. NOW things that to get really expensive.
7373
info!("snapshotting the state of the interpreter");
7474

75-
if self.snapshots.insert(EvalSnapshot::new(memory, stack)) {
75+
if self.snapshots.insert(InterpSnapshot::new(memory, stack)) {
7676
// Spurious collision or first cycle
7777
return Ok(())
7878
}
@@ -384,18 +384,18 @@ impl<'a, 'b, 'mir, 'tcx: 'a+'mir> SnapshotContext<'b>
384384
/// The virtual machine state during const-evaluation at a given point in time.
385385
/// We assume the `CompileTimeInterpreter` has no interesting extra state that
386386
/// is worth considering here.
387-
struct EvalSnapshot<'a, 'mir, 'tcx: 'a + 'mir> {
387+
struct InterpSnapshot<'a, 'mir, 'tcx: 'a + 'mir> {
388388
memory: Memory<'a, 'mir, 'tcx, CompileTimeInterpreter<'a, 'mir, 'tcx>>,
389389
stack: Vec<Frame<'mir, 'tcx>>,
390390
}
391391

392-
impl<'a, 'mir, 'tcx: 'a + 'mir> EvalSnapshot<'a, 'mir, 'tcx>
392+
impl<'a, 'mir, 'tcx: 'a + 'mir> InterpSnapshot<'a, 'mir, 'tcx>
393393
{
394394
fn new(
395395
memory: &Memory<'a, 'mir, 'tcx, CompileTimeInterpreter<'a, 'mir, 'tcx>>,
396396
stack: &[Frame<'mir, 'tcx>]
397397
) -> Self {
398-
EvalSnapshot {
398+
InterpSnapshot {
399399
memory: memory.clone(),
400400
stack: stack.into(),
401401
}
@@ -411,7 +411,7 @@ impl<'a, 'mir, 'tcx: 'a + 'mir> EvalSnapshot<'a, 'mir, 'tcx>
411411

412412
}
413413

414-
impl<'a, 'mir, 'tcx> Hash for EvalSnapshot<'a, 'mir, 'tcx>
414+
impl<'a, 'mir, 'tcx> Hash for InterpSnapshot<'a, 'mir, 'tcx>
415415
{
416416
fn hash<H: Hasher>(&self, state: &mut H) {
417417
// Implement in terms of hash stable, so that k1 == k2 -> hash(k1) == hash(k2)
@@ -422,16 +422,16 @@ impl<'a, 'mir, 'tcx> Hash for EvalSnapshot<'a, 'mir, 'tcx>
422422
}
423423
}
424424

425-
impl_stable_hash_for!(impl<'tcx, 'b, 'mir> for struct EvalSnapshot<'b, 'mir, 'tcx> {
425+
impl_stable_hash_for!(impl<'tcx, 'b, 'mir> for struct InterpSnapshot<'b, 'mir, 'tcx> {
426426
// Not hashing memory: Avoid hashing memory all the time during execution
427427
memory -> _,
428428
stack,
429429
});
430430

431-
impl<'a, 'mir, 'tcx> Eq for EvalSnapshot<'a, 'mir, 'tcx>
431+
impl<'a, 'mir, 'tcx> Eq for InterpSnapshot<'a, 'mir, 'tcx>
432432
{}
433433

434-
impl<'a, 'mir, 'tcx> PartialEq for EvalSnapshot<'a, 'mir, 'tcx>
434+
impl<'a, 'mir, 'tcx> PartialEq for InterpSnapshot<'a, 'mir, 'tcx>
435435
{
436436
fn eq(&self, other: &Self) -> bool {
437437
// FIXME: This looks to be a *ridiculously expensive* comparison operation.

0 commit comments

Comments
 (0)