@@ -62,14 +62,13 @@ impl<'a, 'mir, 'tcx, M> InfiniteLoopDetector<'a, 'mir, 'tcx, M>
6262 pub fn observe_and_analyze (
6363 & mut self ,
6464 tcx : & TyCtxt < ' b , ' tcx , ' tcx > ,
65- machine : & M ,
6665 memory : & Memory < ' a , ' mir , ' tcx , M > ,
6766 stack : & [ Frame < ' mir , ' tcx > ] ,
6867 ) -> EvalResult < ' tcx , ( ) > {
6968
7069 let mut hcx = tcx. get_stable_hashing_context ( ) ;
7170 let mut hasher = StableHasher :: < u64 > :: new ( ) ;
72- ( machine , stack) . hash_stable ( & mut hcx, & mut hasher) ;
71+ stack. hash_stable ( & mut hcx, & mut hasher) ;
7372 let hash = hasher. finish ( ) ;
7473
7574 if self . hashes . insert ( hash) {
@@ -79,7 +78,7 @@ impl<'a, 'mir, 'tcx, M> InfiniteLoopDetector<'a, 'mir, 'tcx, M>
7978
8079 info ! ( "snapshotting the state of the interpreter" ) ;
8180
82- if self . snapshots . insert ( EvalSnapshot :: new ( machine , memory, stack) ) {
81+ if self . snapshots . insert ( EvalSnapshot :: new ( memory, stack) ) {
8382 // Spurious collision or first cycle
8483 return Ok ( ( ) )
8584 }
@@ -345,7 +344,6 @@ impl<'a, 'b, 'mir, 'tcx, M> SnapshotContext<'b> for Memory<'a, 'mir, 'tcx, M>
345344
346345/// The virtual machine state during const-evaluation at a given point in time.
347346struct EvalSnapshot < ' a , ' mir , ' tcx : ' a + ' mir , M : Machine < ' mir , ' tcx > > {
348- machine : M ,
349347 memory : Memory < ' a , ' mir , ' tcx , M > ,
350348 stack : Vec < Frame < ' mir , ' tcx > > ,
351349}
@@ -354,21 +352,20 @@ impl<'a, 'mir, 'tcx, M> EvalSnapshot<'a, 'mir, 'tcx, M>
354352 where M : Machine < ' mir , ' tcx > ,
355353{
356354 fn new (
357- machine : & M ,
358355 memory : & Memory < ' a , ' mir , ' tcx , M > ,
359- stack : & [ Frame < ' mir , ' tcx > ] ) -> Self {
360-
356+ stack : & [ Frame < ' mir , ' tcx > ]
357+ ) -> Self {
361358 EvalSnapshot {
362- machine : machine. clone ( ) ,
363359 memory : memory. clone ( ) ,
364360 stack : stack. into ( ) ,
365361 }
366362 }
367363
368364 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 ( ) )
372369 }
373370}
374371
@@ -384,17 +381,19 @@ impl<'a, 'mir, 'tcx, M> Hash for EvalSnapshot<'a, 'mir, 'tcx, M>
384381 }
385382}
386383
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.
387386impl < ' a , ' b , ' mir , ' tcx , M > HashStable < StableHashingContext < ' b > >
388387 for EvalSnapshot < ' a , ' mir , ' tcx , M >
389388 where M : Machine < ' mir , ' tcx > ,
390389{
391390 fn hash_stable < W : StableHasherResult > (
392391 & self ,
393392 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) ;
398397 }
399398}
400399
0 commit comments