Skip to content

Commit 87306f1

Browse files
authored
Merge pull request rust-lang#38 from oli-obk/dont_step_up_to_the_const
don't execute the first statement of a constant/static/promoted right away
2 parents f28feed + 7d574f7 commit 87306f1

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/interpreter/step.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,9 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
3939
}.visit_statement(block, stmt);
4040
if current_stack == self.stack.len() {
4141
self.statement(stmt)?;
42-
} else {
43-
// ConstantExtractor added some new frames for statics/constants/promoteds
44-
// self.step() can't be "done", so it can't return false
45-
assert!(self.step()?);
4642
}
43+
// if ConstantExtractor added new frames, we don't execute anything here
44+
// but await the next call to step
4745
return Ok(true);
4846
}
4947

@@ -58,11 +56,9 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
5856
}.visit_terminator(block, terminator);
5957
if current_stack == self.stack.len() {
6058
self.terminator(terminator)?;
61-
} else {
62-
// ConstantExtractor added some new frames for statics/constants/promoteds
63-
// self.step() can't be "done", so it can't return false
64-
assert!(self.step()?);
6559
}
60+
// if ConstantExtractor added new frames, we don't execute anything here
61+
// but await the next call to step
6662
Ok(true)
6763
}
6864

0 commit comments

Comments
 (0)