@@ -59,6 +59,8 @@ impl<'mir, 'tcx> EvalContextExt<'tcx> for super::MiriEvalContext<'mir, 'tcx> {
59
59
// If intptrcast is enabled, treat everything of integer *type* at integer *value*.
60
60
if self . memory ( ) . extra . rng . is_some ( ) && left. layout . ty . is_integral ( ) {
61
61
// This is actually an integer operation, so dispatch back to the core engine.
62
+ // TODO: Once intptrcast is the default, librustc_mir should never even call us
63
+ // for integer types.
62
64
assert ! ( right. layout. ty. is_integral( ) ) ;
63
65
let l_bits = self . force_bits ( left. imm . to_scalar ( ) ?, left. layout . size ) ?;
64
66
let r_bits = self . force_bits ( right. imm . to_scalar ( ) ?, right. layout . size ) ?;
@@ -186,6 +188,13 @@ impl<'mir, 'tcx> EvalContextExt<'tcx> for super::MiriEvalContext<'mir, 'tcx> {
186
188
right : Scalar < Tag > ,
187
189
) -> InterpResult < ' tcx , bool > {
188
190
let size = self . pointer_size ( ) ;
191
+ if self . memory ( ) . extra . rng . is_some ( ) {
192
+ // Just compare the integers.
193
+ // TODO: Do we really want to *always* do that, even when comparing two live in-bounds pointers?
194
+ let left = self . force_bits ( left, size) ?;
195
+ let right = self . force_bits ( right, size) ?;
196
+ return Ok ( left == right) ;
197
+ }
189
198
Ok ( match ( left, right) {
190
199
( Scalar :: Raw { .. } , Scalar :: Raw { .. } ) =>
191
200
left. to_bits ( size) ? == right. to_bits ( size) ?,
0 commit comments