11use std:: fmt:: Write ;
22use std:: hash:: { Hash , Hasher } ;
3- use std:: { mem, ptr } ;
3+ use std:: mem;
44
55use rustc:: hir:: def_id:: DefId ;
66use rustc:: hir:: def:: Def ;
@@ -98,8 +98,8 @@ impl<'mir, 'tcx: 'mir> Eq for Frame<'mir, 'tcx> {}
9898impl < ' mir , ' tcx : ' mir > PartialEq for Frame < ' mir , ' tcx > {
9999 fn eq ( & self , other : & Self ) -> bool {
100100 let Frame {
101- mir,
102- instance : _ ,
101+ mir : _ ,
102+ instance,
103103 span : _,
104104 return_to_block,
105105 return_place,
@@ -108,8 +108,10 @@ impl<'mir, 'tcx: 'mir> PartialEq for Frame<'mir, 'tcx> {
108108 stmt,
109109 } = self ;
110110
111- ptr:: eq ( mir, & other. mir )
112- && * return_to_block == other. return_to_block // TODO: Are these two necessary?
111+ // Some of these are constant during evaluation, but are included
112+ // anyways for correctness.
113+ * instance == other. instance
114+ && * return_to_block == other. return_to_block
113115 && * return_place == other. return_place
114116 && * locals == other. locals
115117 && * block == other. block
@@ -120,8 +122,8 @@ impl<'mir, 'tcx: 'mir> PartialEq for Frame<'mir, 'tcx> {
120122impl < ' mir , ' tcx : ' mir > Hash for Frame < ' mir , ' tcx > {
121123 fn hash < H : Hasher > ( & self , state : & mut H ) {
122124 let Frame {
123- mir,
124- instance : _ ,
125+ mir : _ ,
126+ instance,
125127 span : _,
126128 return_to_block,
127129 return_place,
@@ -130,7 +132,7 @@ impl<'mir, 'tcx: 'mir> Hash for Frame<'mir, 'tcx> {
130132 stmt,
131133 } = self ;
132134
133- ( mir as * const _ as usize ) . hash ( state) ;
135+ instance . hash ( state) ;
134136 return_to_block. hash ( state) ;
135137 return_place. hash ( state) ;
136138 locals. hash ( state) ;
0 commit comments