use std::fmt::Write;
use std::hash::{Hash, Hasher};
-use std::{mem, ptr};
+use std::mem;
use rustc::hir::def_id::DefId;
use rustc::hir::def::Def;
impl<'mir, 'tcx: 'mir> PartialEq for Frame<'mir, 'tcx> {
fn eq(&self, other: &Self) -> bool {
let Frame {
- mir,
- instance: _,
+ mir: _,
+ instance,
span: _,
return_to_block,
return_place,
stmt,
} = self;
- ptr::eq(mir, &other.mir)
- && *return_to_block == other.return_to_block // TODO: Are these two necessary?
+ // Some of these are constant during evaluation, but are included
+ // anyways for correctness.
+ *instance == other.instance
+ && *return_to_block == other.return_to_block
&& *return_place == other.return_place
&& *locals == other.locals
&& *block == other.block
impl<'mir, 'tcx: 'mir> Hash for Frame<'mir, 'tcx> {
fn hash<H: Hasher>(&self, state: &mut H) {
let Frame {
- mir,
- instance: _,
+ mir: _,
+ instance,
span: _,
return_to_block,
return_place,
stmt,
} = self;
- (mir as *const _ as usize).hash(state);
+ instance.hash(state);
return_to_block.hash(state);
return_place.hash(state);
locals.hash(state);
alloc_kind,
alloc_map,
cur_frame,
- tcx,
+ tcx: _,
} = self;
*data == other.data
&& *alloc_kind == other.alloc_kind
&& *alloc_map == other.alloc_map
&& *cur_frame == other.cur_frame
- && ptr::eq(tcx, &other.tcx)
}
}
alloc_kind: _,
alloc_map: _,
cur_frame,
- tcx,
+ tcx: _,
} = self;
data.hash(state);
cur_frame.hash(state);
- (tcx as *const _ as usize).hash(state);
// We ignore some fields which don't change between evaluation steps.