1
1
use std:: fmt:: Write ;
2
2
use std:: hash:: { Hash , Hasher } ;
3
- use std:: { mem, ptr } ;
3
+ use std:: mem;
4
4
5
5
use rustc:: hir:: def_id:: DefId ;
6
6
use rustc:: hir:: def:: Def ;
@@ -98,8 +98,8 @@ impl<'mir, 'tcx: 'mir> Eq for Frame<'mir, 'tcx> {}
98
98
impl < ' mir , ' tcx : ' mir > PartialEq for Frame < ' mir , ' tcx > {
99
99
fn eq ( & self , other : & Self ) -> bool {
100
100
let Frame {
101
- mir,
102
- instance : _ ,
101
+ mir : _ ,
102
+ instance,
103
103
span : _,
104
104
return_to_block,
105
105
return_place,
@@ -108,8 +108,10 @@ impl<'mir, 'tcx: 'mir> PartialEq for Frame<'mir, 'tcx> {
108
108
stmt,
109
109
} = self ;
110
110
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
113
115
&& * return_place == other. return_place
114
116
&& * locals == other. locals
115
117
&& * block == other. block
@@ -120,8 +122,8 @@ impl<'mir, 'tcx: 'mir> PartialEq for Frame<'mir, 'tcx> {
120
122
impl < ' mir , ' tcx : ' mir > Hash for Frame < ' mir , ' tcx > {
121
123
fn hash < H : Hasher > ( & self , state : & mut H ) {
122
124
let Frame {
123
- mir,
124
- instance : _ ,
125
+ mir : _ ,
126
+ instance,
125
127
span : _,
126
128
return_to_block,
127
129
return_place,
@@ -130,7 +132,7 @@ impl<'mir, 'tcx: 'mir> Hash for Frame<'mir, 'tcx> {
130
132
stmt,
131
133
} = self ;
132
134
133
- ( mir as * const _ as usize ) . hash ( state) ;
135
+ instance . hash ( state) ;
134
136
return_to_block. hash ( state) ;
135
137
return_place. hash ( state) ;
136
138
locals. hash ( state) ;
0 commit comments