@@ -62,14 +62,13 @@ impl<'a, 'mir, 'tcx, M> InfiniteLoopDetector<'a, 'mir, 'tcx, M>
62
62
pub fn observe_and_analyze (
63
63
& mut self ,
64
64
tcx : & TyCtxt < ' b , ' tcx , ' tcx > ,
65
- machine : & M ,
66
65
memory : & Memory < ' a , ' mir , ' tcx , M > ,
67
66
stack : & [ Frame < ' mir , ' tcx > ] ,
68
67
) -> EvalResult < ' tcx , ( ) > {
69
68
70
69
let mut hcx = tcx. get_stable_hashing_context ( ) ;
71
70
let mut hasher = StableHasher :: < u64 > :: new ( ) ;
72
- ( machine , stack) . hash_stable ( & mut hcx, & mut hasher) ;
71
+ stack. hash_stable ( & mut hcx, & mut hasher) ;
73
72
let hash = hasher. finish ( ) ;
74
73
75
74
if self . hashes . insert ( hash) {
@@ -79,7 +78,7 @@ impl<'a, 'mir, 'tcx, M> InfiniteLoopDetector<'a, 'mir, 'tcx, M>
79
78
80
79
info ! ( "snapshotting the state of the interpreter" ) ;
81
80
82
- if self . snapshots . insert ( EvalSnapshot :: new ( machine , memory, stack) ) {
81
+ if self . snapshots . insert ( EvalSnapshot :: new ( memory, stack) ) {
83
82
// Spurious collision or first cycle
84
83
return Ok ( ( ) )
85
84
}
@@ -345,7 +344,6 @@ impl<'a, 'b, 'mir, 'tcx, M> SnapshotContext<'b> for Memory<'a, 'mir, 'tcx, M>
345
344
346
345
/// The virtual machine state during const-evaluation at a given point in time.
347
346
struct EvalSnapshot < ' a , ' mir , ' tcx : ' a + ' mir , M : Machine < ' mir , ' tcx > > {
348
- machine : M ,
349
347
memory : Memory < ' a , ' mir , ' tcx , M > ,
350
348
stack : Vec < Frame < ' mir , ' tcx > > ,
351
349
}
@@ -354,21 +352,20 @@ impl<'a, 'mir, 'tcx, M> EvalSnapshot<'a, 'mir, 'tcx, M>
354
352
where M : Machine < ' mir , ' tcx > ,
355
353
{
356
354
fn new (
357
- machine : & M ,
358
355
memory : & Memory < ' a , ' mir , ' tcx , M > ,
359
- stack : & [ Frame < ' mir , ' tcx > ] ) -> Self {
360
-
356
+ stack : & [ Frame < ' mir , ' tcx > ]
357
+ ) -> Self {
361
358
EvalSnapshot {
362
- machine : machine. clone ( ) ,
363
359
memory : memory. clone ( ) ,
364
360
stack : stack. into ( ) ,
365
361
}
366
362
}
367
363
368
364
fn snapshot < ' b : ' a > ( & ' b self )
369
- -> ( & ' b M , MemorySnapshot < ' b , ' mir , ' tcx , M > , Vec < FrameSnapshot < ' a , ' tcx > > ) {
370
- let EvalSnapshot { machine, memory, stack } = self ;
371
- ( & machine, memory. snapshot ( ) , stack. iter ( ) . map ( |frame| frame. snapshot ( memory) ) . collect ( ) )
365
+ -> ( MemorySnapshot < ' b , ' mir , ' tcx , M > , Vec < FrameSnapshot < ' a , ' tcx > > )
366
+ {
367
+ let EvalSnapshot { memory, stack } = self ;
368
+ ( memory. snapshot ( ) , stack. iter ( ) . map ( |frame| frame. snapshot ( memory) ) . collect ( ) )
372
369
}
373
370
}
374
371
@@ -384,17 +381,19 @@ impl<'a, 'mir, 'tcx, M> Hash for EvalSnapshot<'a, 'mir, 'tcx, M>
384
381
}
385
382
}
386
383
384
+ // Not using the macro because we need special handling for `memory`, which the macro
385
+ // does not support at the same time as the extra bounds on the type.
387
386
impl < ' a , ' b , ' mir , ' tcx , M > HashStable < StableHashingContext < ' b > >
388
387
for EvalSnapshot < ' a , ' mir , ' tcx , M >
389
388
where M : Machine < ' mir , ' tcx > ,
390
389
{
391
390
fn hash_stable < W : StableHasherResult > (
392
391
& self ,
393
392
hcx : & mut StableHashingContext < ' b > ,
394
- hasher : & mut StableHasher < W > ) {
395
-
396
- let EvalSnapshot { machine , memory, stack } = self ;
397
- ( machine , & memory . data , stack) . hash_stable ( hcx, hasher) ;
393
+ hasher : & mut StableHasher < W > )
394
+ {
395
+ let EvalSnapshot { memory : _ , stack } = self ;
396
+ stack. hash_stable ( hcx, hasher) ;
398
397
}
399
398
}
400
399
0 commit comments