diff options
| author | Ralf Jung <post@ralfj.de> | 2020-08-09 17:47:29 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2020-08-09 18:14:28 +0200 |
| commit | a0e057540eb996ea43ba5e0dce2b69fa972f718f (patch) | |
| tree | c46e51cfdaa34c65f52653b793f3fe51ecb86614 | |
| parent | bff69c9525b8c498fb6485ac38b4b3497bb37c1a (diff) | |
| download | rust-a0e057540eb996ea43ba5e0dce2b69fa972f718f.tar.gz rust-a0e057540eb996ea43ba5e0dce2b69fa972f718f.zip | |
evaluate required_consts when pushing stack frame in Miri engine
| -rw-r--r-- | src/librustc_mir/interpret/eval_context.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index fc192cd9b3c..7c2f749c156 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -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); |
