Skip to content

Commit

Permalink
Use EvalContext's TyCtx for the purpose of hashing the evaluation con…
Browse files Browse the repository at this point in the history
…text
  • Loading branch information
brunocodutra committed Sep 3, 2018
1 parent add9ee2 commit a26ceb3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/librustc_mir/interpret/eval_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,13 @@ impl<'a, 'mir, 'tcx, M> InfiniteLoopDetector<'a, 'mir, 'tcx, M>

pub fn observe_and_analyze(
&mut self,
tcx: &TyCtxt<'b, 'tcx, 'tcx>,
machine: &M,
memory: &Memory<'a, 'mir, 'tcx, M>,
stack: &[Frame<'mir, 'tcx>],
) -> EvalResult<'tcx, ()> {

let mut hcx = memory.tcx.get_stable_hashing_context();
let mut hcx = tcx.get_stable_hashing_context();
let mut hasher = StableHasher::<u64>::new();
(machine, stack).hash_stable(&mut hcx, &mut hasher);
let hash = hasher.finish();
Expand Down
7 changes: 6 additions & 1 deletion src/librustc_mir/interpret/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {
"Constant evaluating a complex constant, this might take some time");
}

self.loop_detector.observe_and_analyze(&self.machine, &self.memory, &self.stack[..])
self.loop_detector.observe_and_analyze(
&self.tcx,
&self.machine,
&self.memory,
&self.stack[..],
)
}

pub fn run(&mut self) -> EvalResult<'tcx> {
Expand Down

0 comments on commit a26ceb3

Please sign in to comment.