Skip to content

Commit a0e0575

Browse files
committed
evaluate required_consts when pushing stack frame in Miri engine
1 parent bff69c9 commit a0e0575

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/librustc_mir/interpret/eval_context.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,13 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
652652
let frame = M::init_frame_extra(self, pre_frame)?;
653653
self.stack_mut().push(frame);
654654

655+
// Make sure all the constants required by this frame evaluate successfully (post-monomorphization check).
656+
for const_ in &body.required_consts {
657+
let const_ =
658+
self.subst_from_current_frame_and_normalize_erasing_regions(const_.literal);
659+
self.const_to_op(const_, None)?;
660+
}
661+
655662
// Locals are initially uninitialized.
656663
let dummy = LocalState { value: LocalValue::Uninitialized, layout: Cell::new(None) };
657664
let mut locals = IndexVec::from_elem(dummy, &body.local_decls);

0 commit comments

Comments
 (0)