Skip to content

Commit

Permalink
evaluate required_consts when pushing stack frame in Miri engine
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Aug 9, 2020
1 parent bff69c9 commit a0e0575
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/librustc_mir/interpret/eval_context.rs
Expand Up @@ -652,6 +652,13 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
let frame = M::init_frame_extra(self, pre_frame)?;
self.stack_mut().push(frame);

// Make sure all the constants required by this frame evaluate successfully (post-monomorphization check).
for const_ in &body.required_consts {
let const_ =
self.subst_from_current_frame_and_normalize_erasing_regions(const_.literal);
self.const_to_op(const_, None)?;
}

// Locals are initially uninitialized.
let dummy = LocalState { value: LocalValue::Uninitialized, layout: Cell::new(None) };
let mut locals = IndexVec::from_elem(dummy, &body.local_decls);
Expand Down

0 comments on commit a0e0575

Please sign in to comment.