Skip to content

Commit a26ceb3

Browse files
committed
Use EvalContext's TyCtx for the purpose of hashing the evaluation context
1 parent add9ee2 commit a26ceb3

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/librustc_mir/interpret/eval_context.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -227,12 +227,13 @@ impl<'a, 'mir, 'tcx, M> InfiniteLoopDetector<'a, 'mir, 'tcx, M>
227227

228228
pub fn observe_and_analyze(
229229
&mut self,
230+
tcx: &TyCtxt<'b, 'tcx, 'tcx>,
230231
machine: &M,
231232
memory: &Memory<'a, 'mir, 'tcx, M>,
232233
stack: &[Frame<'mir, 'tcx>],
233234
) -> EvalResult<'tcx, ()> {
234235

235-
let mut hcx = memory.tcx.get_stable_hashing_context();
236+
let mut hcx = tcx.get_stable_hashing_context();
236237
let mut hasher = StableHasher::<u64>::new();
237238
(machine, stack).hash_stable(&mut hcx, &mut hasher);
238239
let hash = hasher.finish();

src/librustc_mir/interpret/step.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,12 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {
7373
"Constant evaluating a complex constant, this might take some time");
7474
}
7575

76-
self.loop_detector.observe_and_analyze(&self.machine, &self.memory, &self.stack[..])
76+
self.loop_detector.observe_and_analyze(
77+
&self.tcx,
78+
&self.machine,
79+
&self.memory,
80+
&self.stack[..],
81+
)
7782
}
7883

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

0 commit comments

Comments
 (0)